Commit Graph

41 Commits (fcdb148bf2e0c040a41792f4f7c030672ba59d66)

Author SHA1 Message Date
lethosor 017e280b18
Define identity_traits<shared_ptr<T>> for all T (opaque for now) 2023-09-13 21:57:44 -04:00
lethosor fd676fa70f
Add identity_traits for std::unordered_map 2023-09-12 23:38:09 -04:00
Kelly Kinkade dbee92cd81 `widget` is a `struct` not a `class`
at least as far as df-structures is concerned...
2023-09-12 22:01:58 -05:00
Kelly Kinkade 673d9d5230 bodge DataIdentity to get 50.10 working 2023-09-12 21:55:55 -05:00
Kelly Kinkade ba0df78233 DataIdentity support for `std::future<void>` 2023-08-04 20:00:29 -05:00
lethosor 8b786b4344
Forward-declare types only used in DataIdentity.cpp 2023-08-02 00:15:27 -04:00
lethosor 2f42745175
Add identity_traits<condition_variable>, add macro for opaque identities 2023-08-02 00:15:27 -04:00
lethosor e5bc4b3221
Add identity for std::mutex 2023-08-02 00:15:25 -04:00
lethosor feeefcf149
Add read-only container_identity for std::map 2023-01-03 01:16:42 -05:00
Ben Lubar c06d1f8e52
tagged union support for lua (#1818) 2021-03-30 15:55:06 -05:00
Pauli f0632347d0 Remove Core.h include from DataDefs.h
Core.h isn't required for DataDefs.h which removes Core.h dependency
from DataStatics*.
2018-12-30 17:08:42 -05:00
Japa 08cc9f3188 Cast size_t to int explicitly to avoid compiler warning C4267 2016-10-15 10:31:38 +05:30
lethosor e22b3b1de7 Use non-fixed-width types in integer identity_traits definitions
In some situations (e.g. 32-bit Linux), "intptr_t" is defined as "int", which is
equivalent to "int32_t", leading to issues with duplicate definitions. In other
situations with GCC, "intptr_t" is "long", which isn't covered by any intNN_t
types. Also, definitions for "long" already had to be added on Windows, because
no fixed-width types in MSVC are equivalent to "long".

Switching to non-fixed-width types should hopefully cover all of these
situations. If this doesn't cover any integer types that we need, it will
be caught quickly, e.g. by references to integer_traits<T> in LuaWrapper.cpp.
2016-08-08 11:46:20 -04:00
lethosor 7b7f7a1b79 Fix support for integer fields in Lua 5.3 2016-07-28 16:36:02 -04:00
Vitaly Pronkin 8916aba3bf win64 fixes (partial)
cherry-picked from 2f734ae2317060edb83021f17cffc966c435ad7b
2016-07-27 19:46:49 -04:00
Vitaly Pronkin fe18f176f7 More 64-bit fixes
Cherry-picked from 7eb3ba6
- Lua update already done in e2c6350, 4dd411e
- Excluded library/modules/Buildings.cpp
2016-07-26 23:47:53 -04:00
lethosor 2455e36510 Initial 64-bit support 2016-07-03 23:32:43 -04:00
Alexander Gavrilov 6046d68639 Support std::fstream in data structures and add file_compressorst to xml.
One tricky thing is that fstream does not have operator=, so the new
file_compressorst requires a manually implemented one that skips it.
2014-09-24 22:47:04 +04:00
Alexander Gavrilov 788bc55096 Fix a mistake in the lua resize() method of BitArray. 2014-04-04 22:33:05 +04:00
Petr Mrázek 8812238bf6 Update license, add contributors file, bump release number 2012-09-30 04:03:37 +02:00
Alexander Gavrilov 3b8e3d1459 Fix wrong assumptions in lua wrapper for BitArray. 2012-09-02 17:18:01 +04:00
Alexander Gavrilov c6694e386f Add rather inefficient type_identity wrapping for std::set.
Accessing an element is O(N), as if it was walking a list.
2012-08-18 14:34:20 +04:00
Alexander Gavrilov 3282ac3db2 Add a hotkey command that sorts units in lists using lua comparators. 2012-04-21 15:43:52 +04:00
Alexander Gavrilov d95cc3435f Fix lua wrapper sizeof for static arrays.
Since it actually depends on the element type, it is more tricky.
2012-04-20 13:04:03 +04:00
Alexander Gavrilov 14709e5d45 Add an official core lua context, and allow plugins to send events to it.
- This context requires core suspend lock and asserts it in a few places.
- Special 'event' objects are introduced. They can be invoked as
  functions, in which case they iterate all their fields and call
  them as functions. Errors are printed and consumed.
- When a plugin is opened by the core context, events registered in
  a special array are linked to it. The system is organized so as to
  avoid even trying to pass the event to lua if the module isn't loaded.
2012-04-15 19:09:25 +04:00
Alexander Gavrilov cb49c92b99 Allow plugins to export functions to lua with safe reload support.
- To ensure reload safety functions have to be wrapped. Every call
  checks the loaded state and locks a mutex in Plugin. If the plugin
  is unloaded, calling its functions throws a lua error. Therefore,
  plugins may not create closures or export yieldable functions.

- The set of function argument and return types supported by
  LuaWrapper is severely limited when compared to being compiled
  inside the main library.
  Currently supported types: numbers, bool, std::string, df::foo,
  df::foo*, std::vector<bool>, std::vector<df::foo*>.

- To facilitate postponing initialization until after all plugins
  have been loaded, the core sends a SC_CORE_INITIALIZED event.

- As an example, the burrows plugin now exports its functions.
2012-04-14 19:44:07 +04:00
Alexander Gavrilov d1b27418a6 Add a World::GetPersistentData version that auto-adds if not found. 2012-04-05 11:32:23 +04: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
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 8d345be6e7 Expose virtual methods in the lua wrapper. 2012-03-25 14:06:05 +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
Alexander Gavrilov 053bfe345c Implement allocation and copy for c++ objects in the lua wrapper. 2012-03-24 12:43:53 +04: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 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 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