Commit Graph

1181 Commits (aaffdd56d8c2684667082372ea4effd02d3f4b2a)

Author SHA1 Message Date
Alexander Gavrilov a8fe0eccb4 Add functions for checking validity of lua wrapper objects. 2012-04-02 22:02:04 +04:00
Petr Mrázek 467f4108ae Track structures 2012-04-02 13:42:56 +02:00
Petr Mrázek 2a998a5b8a Merge https://github.com/quietust/dfhack 2012-04-02 13:42:18 +02:00
Quietust 06da0f9720 Fix coord/coord2d division/modulo operators to properly handle negative numbers (fixes some glitches with revflood and possibly other utils) 2012-04-01 19:44:35 -05:00
Alexander Gavrilov d109b6570b Add dfhack.with_suspend(f[, args...]) that calls f with core suspended.
The lock is properly removed in case of error, which is then propagated.
Just for fun, it also can be yielded from within in a coroutine.
2012-04-01 19:38:42 +04:00
Alexander Gavrilov e3d50b9b04 Optimize wrapper: use pointers instead of strings as most frequent keys. 2012-04-01 18:34:04 +04:00
Alexander Gavrilov 604c84953b Fix a bug: LookupTypeInfo cannot assume the result is userdata. 2012-04-01 17:59:47 +04:00
Alexander Gavrilov a3e526abdb Add df.is_instance(a,b) to check if typeof(b) is subtype of typeof(a).
Allows both objects and types as arguments. Also accepts nil and
primitives as b, returning nil.
2012-04-01 17:32:57 +04:00
Alexander Gavrilov edd63080b5 Only print the shortcut help once in the lua interactive mode. 2012-04-01 17:00:25 +04:00
Alexander Gavrilov afe4eba957 Improve performance of the persistent data api, and wrap it for lua.
Use an stl table for string keys to avoid linear cost of lookup.

This uncovered a bug in the new luaL_getsubtable function.
2012-04-01 16:43:40 +04:00
Alexander Gavrilov a9a6fbd8b5 Lua tweaks: a couple of functions, dfusion tweak, backtrace metadata. 2012-04-01 12:50:56 +04:00
Petr Mrázek 7ff728b6fc Track world and map changes separately for plugin_onstatechange 2012-04-01 02:56:54 +02:00
Petr Mrázek 209b261284 Get rid of MALLOC_FILL build option 2012-04-01 00:30:42 +02:00
Petr Mrázek 4bac6edd79 Merge https://github.com/rh73/dfhack 2012-04-01 00:29:00 +02:00
Alexander Gavrilov 9d6e26fa5f Fix crashing color_ostream::printerr due to vfprintf vs fprintf mixup.
Also enable heap clearing in gdb mode, and fix a few newlines.
2012-03-31 22:26:41 +04:00
Robert Heinrich 39787e9cd5 Renamed digging commands to uniformly start with 'dig*'(vdig -> digv etc). Added command digl, diglx (dig layerstone instead of veins). Updated readme.rst. 2012-03-31 15:41:55 +02:00
Alexander Gavrilov 0f41608ed4 Pull console output support and REPL out of dfusion into core lib. 2012-03-31 15:40:54 +04:00
Alexander Gavrilov 9384f0c842 Update lua to 5.2 and fix obvious breakage due to obsolete api. 2012-03-31 12:11:43 +04:00
Alexander Gavrilov 10b610669f Give some sensible looking names to the arrays in pregnancy_ptr. 2012-03-31 10:31:45 +04:00
Petr Mrázek a01f512733 Track structures 2012-03-31 01:33:14 +02:00
Petr Mrázek 543f3970db Tweak readme, bump version to 0.34.07 2012-03-31 01:13:21 +02:00
Petr Mrázek 5d8415c8d9 Merge https://github.com/warmist/dfhack
Conflicts:
	plugins/Dfusion/luafiles/init.lua
2012-03-30 20:32:57 +02:00
Alexander Gavrilov 81bc73f435 Follow a typo fix in flag name. 2012-03-30 10:44:52 +04:00
Quietust 07bb51946f Fix bug in MapCache - squash veins with the correct priority 2012-03-29 18:59:07 -05:00
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