Commit Graph

1137 Commits (4b2837dc397e363c8e6d65edebd90199232bffa9)

Author SHA1 Message Date
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 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
Alexander Gavrilov 9b78fffe92 Support containers in the lua wrapper. 2012-03-21 13:26:53 +04:00
Alexander Gavrilov 73e138c9fd Support ordinary struct and class fields. 2012-03-20 21:34:27 +04:00
Alexander Gavrilov 6c661bcaa9 Add support for primitive type fields in lua wrapper. 2012-03-20 13:56:29 +04:00
Alexander Gavrilov dbbd9acfad Export the type tree with enum keys to lua. 2012-03-19 20:12:27 +04:00
Alexander Gavrilov 296d3a0af3 Skeleton type metadata for future use in lua bindings. 2012-03-19 16:59:11 +04:00
Alexander Gavrilov bfb226b92e Add a few comments. 2012-03-19 11:33:30 +04:00
Quietust cf58876a8e Need to return a value here 2012-03-18 14:42:36 -05:00
Alexander Gavrilov d4626f9751 Add unit professions and filtering on status. 2012-03-18 15:35:38 +04:00
Alexander Gavrilov e33414fa69 Export unit curse, squad, death and burrow info. 2012-03-18 13:52:39 +04:00
Alexander Gavrilov 415ae35dff Add RPC calls to query some global state. 2012-03-18 12:09:06 +04:00
Alexander Gavrilov b9ecd03fe2 Make the server suspend the core around calls unless disabled.
I expect the majority of methods will have to suspend the core
first thing anyway, so this will reduce typing and bugs.

Also get rid of the "me->" ugliness by splitting threadFn.
2012-03-18 11:04:15 +04:00
Alexander Gavrilov aa63493bb8 Add a ListSquads request. 2012-03-17 20:04:15 +04:00
Alexander Gavrilov 3d80a1ee35 Use a more obscure serialize method to avoid recalculating byte size. 2012-03-17 17:52:23 +04:00
Alexander Gavrilov 368b92f81f Add a RPC call to retrieve unit info.
For performance reasons, material flag arrays are changed to use ints,
with enum item name mappings retrievable via a different RPC call.
2012-03-17 17:41:56 +04:00
Alexander Gavrilov 15ccfbb086 Add a ListMaterials remote call for bulk download of basic material info. 2012-03-17 15:36:42 +04:00
Alexander Gavrilov 58eb199036 Add many new template functions for enums & bitfields.
An incompatible change: ENUM_KEY_STR returns std::string now.
The old behavior is available via enum_item_key_str function.
2012-03-17 12:52:22 +04:00
Alexander Gavrilov 14d6a62e1d Move CoreService to a separate file. 2012-03-17 12:09:30 +04:00
Petr Mrázek 3168a2ef62 Add a tiletype function to get basic shapes from shapes. Track modules. 2012-03-16 20:41:07 +01:00
Alexander Gavrilov 976fa18d72 A number of interface tweaks in RemoteClient.
- Associate a default output stream with the whole connection.
  If not explicitly specified in the constructor, uses stdout.
- Add methods that use this default stream to RemoteFunction.
- Add easily usable wrappers for CoreSuspend and CoreResume.
2012-03-16 14:11:46 +04:00
Quietust 5464564ef6 Merge branch 'master' of git://github.com/angavrilov/dfhack
Conflicts:
	library/xml
2012-03-15 20:12:01 -05:00