Commit Graph

1157 Commits (ec48405f0ac03d64660125ff10e7d30579151159)

Author SHA1 Message Date
Alexander Gavrilov ec48405f0a Fix mistake: static initialization code cannot access other static objects.
Specifically, the eid->type() call depends on the order of linking.
2012-03-29 22:56:06 +04:00
Petr Mrázek 004acdad4e Tweaks!
Strip commands.clear() from all plugins
Fix changeitem - a variable name has changed in item flags
2012-03-29 18:37:22 +02:00
Robert Heinrich cc54d5dfa9 Merge branch 'master' of git://github.com/angavrilov/dfhack
Conflicts:
	library/xml
2012-03-29 16:12:54 +02:00
Robert Heinrich 9b75373403 Merge branch 'master' of git://github.com/peterix/dfhack
Conflicts:
	library/xml
2012-03-29 16:03:12 +02:00
Robert Heinrich 88c914142b added plugin changeitem (change material type and base quality) 2012-03-29 15:33:54 +02:00
Alexander Gavrilov a9b7c74a23 Allow assigning NULL lightuserdata to pointers, and export a global.
Otherwise there is no way to specify NULL via recursive lua table assign.
2012-03-29 14:47:33 +04:00
Alexander Gavrilov 85c91c92d8 Implement __pairs and __ipairs for DF objects.
Structs enumerate fields in memory order in pairs().
Containers & biftields enumerate int indexes in ipairs, and
string keys in pairs (i.e. using index-enum for arrays).
2012-03-29 14:39:13 +04:00
Alexander Gavrilov 17ff235c81 Use codegen.out.xml instead of static.inc in cmake code generation rules.
Now only that file is guaranteed to always be overwritten.
2012-03-29 10:59:54 +04:00
Petr Mrázek d82120a3db More fixes
Include unistd.h in linux process file
Fix assert in autolabor
Don't print 'script missing' error on DF start
2012-03-29 02:49:44 +02:00
Petr Mrázek 757ad3334c Track structures 2012-03-29 00:27:03 +02:00
Petr Mrázek 6235d2e801 Merge https://github.com/angavrilov/dfhack 2012-03-28 19:53:10 +02:00
Quietust 95ec363a7f Merge branch 'master' of https://github.com/peterix/dfhack
Conflicts:
	library/LuaTypes.cpp
	library/LuaWrapper.cpp
2012-03-28 11:51:49 -05:00
Alexander Gavrilov e4e643f9d2 Clear the command vector during plugin load and unload to avoid confusion. 2012-03-28 18:47:03 +04:00
Alexander Gavrilov b7ff7681ac Merge remote-tracking branch 'peterix/master' 2012-03-28 15:07:13 +04:00
Petr Mrázek 06188da380 Track structures 2012-03-28 12:46:50 +02:00
Petr Mrázek 40cf5fe538 Track structures 2012-03-28 11:46:23 +02:00
Alexander Gavrilov 929657bed4 Disable pointer auto-vivification unless new is specified.
Since it is essentially allocating non-gc managed objects,
it can lead to memory leaks and shouldn't happen invisibly.
Also support using the 'assign' key to request assign()
from another object before processing the current map.
2012-03-28 17:00:07 +08:00
Alexander Gavrilov fe091de0b2 Fix F keys in keybindings: they obviously don't have unicode symbols. 2012-03-28 17:00:06 +08:00
Alexander Gavrilov b76bdad50f Implement recursive transfer of values from lua to c++ structures.
E.g. df.global.cursor = { x = 1, y = 2, z = 3 }. The lua data
must be represented by raw lua tables.

For structs, the entries in the table are assigned to matching fields.

For containers, if a 'resize' field is missing or nil, the table is
treated like 1-based lua array, and the container is resized to match
its # length. Otherwise, the field must be either an explicit number,
true or false. If it is true, the size is selected by the highest index
in the table. After that, entries are copied using 0-based indices.

For pointers, the table must match the target object. If the pointer
is null, the object is auto-allocated; this can be controlled using
the 'new' field, the value of which will be passed to df.new().
2012-03-28 16:58:51 +08:00
Alexander Gavrilov ee94894516 Disable pointer auto-vivification unless new is specified.
Since it is essentially allocating non-gc managed objects,
it can lead to memory leaks and shouldn't happen invisibly.
Also support using the 'assign' key to request assign()
from another object before processing the current map.
2012-03-28 11:28:42 +04:00
Alexander Gavrilov d6e6fc483f Fix F keys in keybindings: they obviously don't have unicode symbols. 2012-03-28 11:25:55 +04:00
Quietust be2a7af362 Merge branch 'master' of https://github.com/angavrilov/dfhack 2012-03-27 14:14:04 -05:00
Quietust 6656852fff win32 SetConsoleTextAttribute doesn't know what COLOR_RESET (-1) is 2012-03-27 13:22:45 -05:00
Alexander Gavrilov bc74c5984e Implement recursive transfer of values from lua to c++ structures.
E.g. df.global.cursor = { x = 1, y = 2, z = 3 }. The lua data
must be represented by raw lua tables.

For structs, the entries in the table are assigned to matching fields.

For containers, if a 'resize' field is missing or nil, the table is
treated like 1-based lua array, and the container is resized to match
its # length. Otherwise, the field must be either an explicit number,
true or false. If it is true, the size is selected by the highest index
in the table. After that, entries are copied using 0-based indices.

For pointers, the table must match the target object. If the pointer
is null, the object is auto-allocated; this can be controlled using
the 'new' field, the value of which will be passed to df.new().
2012-03-27 21:47:52 +04:00
Alexander Gavrilov 22d775f95c Fix sscanf parsing the memory map on linux, so that dfusion loads. 2012-03-26 21:05:24 +04:00
Petr Mrázek 4e78947b10 Track structures 2012-03-26 16:13:41 +02:00
Alexander Gavrilov 157f23be5c Fix warnings. 2012-03-26 12:42:05 +04:00
Alexander Gavrilov 00a5bfcf3e Work around a msvc issue with spurious specialization ambiguity errors. 2012-03-26 10:46:51 +04:00
Petr Mrázek 1a19e17695 Track structures, stonesense 2012-03-26 03:39:14 +02:00
Alexander Gavrilov d0090e9551 Fix lua wrapper: create one function identity instance per method.
Otherwise all methods of the same prototype are lumped into one.
2012-03-25 21:12:20 +04:00
Alexander Gavrilov 1d81cb56ba Make enum attributes accessible through the lua wrapper.
TODO: make them completely read-only.
2012-03-25 19:12:59 +04:00
Alexander Gavrilov 0412aaebe4 Add a delete() method to the objects in the lua wrapper. 2012-03-25 15:48:18 +04:00
Alexander Gavrilov 7209e4d3f2 Attach static methods to the type objects in the lua wrapper. 2012-03-25 15:20:58 +04:00
Alexander Gavrilov 8d345be6e7 Expose virtual methods in the lua wrapper. 2012-03-25 14:06:05 +04:00
Quietust 947adeac83 Silence warning 4482 2012-03-24 18:18:29 -05:00
Petr Mrázek 645e5eb2c1 track structures 2012-03-24 22:44:16 +01:00
Petr Mrázek 39f722339c Track structures 2012-03-24 17:10:45 +01:00
Alexander Gavrilov 517b2ffadb Merge remote-tracking branch 'peterix/master' 2012-03-24 16:30:07 +04:00
Alexander Gavrilov 0c7fc233bd Support resize/erase/insert for containers, and allow any index in BitArray. 2012-03-24 16:28:53 +04:00
Petr Mrázek 8a847dbaba Tweaks and cleanups
Removed t_virtual.
Made lua use C++ compiler
Removed many silly exception types from Error.h and renamed the rest.
Removed Brush classes from tiletypes plugin.
2012-03-24 12:13:51 +01:00
Alexander Gavrilov d865d54a90 Split LuaWrapper.cpp into two files. 2012-03-24 13:25:10 +04:00
Alexander Gavrilov 053bfe345c Implement allocation and copy for c++ objects in the lua wrapper. 2012-03-24 12:43:53 +04:00
Petr Mrázek 90de6a1b62 Track submodules 2012-03-23 22:59:40 +01:00
Alexander Gavrilov 2b1f8aa2bb Add a _field method that returns refs to struct and container items.
Hack: allocate ad-hoc pointer identities as full lua userdata.
2012-03-23 12:55:29 +04:00
Alexander Gavrilov 6b2006361d Add a _displace method that implements offsetting a pointer by an int. 2012-03-23 11:54:59 +04:00
Alexander Gavrilov 78437310d0 Add a sizeof method/function to retrieve object/type size and address. 2012-03-23 11:30:54 +04:00
Alexander Gavrilov ccc8fac166 Get rid of the write mode field table in metamethods.
Two separate tables can be confusing, e.g. if a builtin field
overrides a writable custom one only in the read table.
2012-03-23 10:56:29 +04:00
Alexander Gavrilov ead28db451 Remove the return type from lua_read, because it always returns 1. 2012-03-23 09:38:49 +04:00
Alexander Gavrilov 27824642d9 Minor refactoring of container indexing and object allocation. 2012-03-22 10:56:32 +04:00
Alexander Gavrilov ad10303cec Implement bitfields and add a _kind metadata field to types and objects. 2012-03-21 20:04:37 +04:00