diff --git a/Memory.xml b/Memory.xml deleted file mode 100644 index 7a125caa1..000000000 --- a/Memory.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - .,:rsr, - :2;,;r2A@@5 - @2::s5A#@@@ @r. . - sd;:riXA#@@ :@@@Gir;;AS9 - Bs::sS3A#@2 @@#AhXirsS#; - iHrLr5d#@@@ .@#95sr;;rie - i*' `*@3 @@A2sr;:;r#5 - :..:rll: @@A5sr::r3@ - @Hr;iZ#@@@@ `:rr;;;;: - S@r.;i2#@@@ @s. .. - @2::ri2A@@# B@G2ir:...5i - :@r,r3X##@@ @G5sr:..,:A - .@Ar;;rSB@@# H#2sr;,..,is - .' `* ,@ASs;:..,:B - ;rr;:,..,:. - `''' - W I N D O W S - - - - -
-
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- - - -
- -
-
-
-
-
-
- -
- - .-"""-. - ' \ - |,. ,-. | _________________________ - |()L( ()| | \ \ - |,' `".| | /_ Argh !!! \ - |.___.',| ` \________________________\ - .j `--"' ` `. - / ' ' \ - / / ` `. - / / ` . - / / l | - . , L I N U X | | - ,"`. .| | - _.' ``. | `..-'l - | `.`, | `. - | `. __.j ) - |__ |--""___| ,-' - `"--...,+"""" `._,.-' - - - - - - - - -
-
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- - -
- -
- -
-
-
-
-
-
- -
- - - - diff --git a/library/Core.cpp b/library/Core.cpp index 96c60ab84..8065efa35 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -651,7 +651,7 @@ bool Core::Init() */ // initialize data defs virtual_identity::Init(this); - InitDataDefGlobals(this); + df::global::InitGlobals(); // create mutex for syncing with interactive tasks StackMutex = new mutex(); diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp index 86c3ea024..77b159205 100644 --- a/library/DataDefs.cpp +++ b/library/DataDefs.cpp @@ -208,22 +208,3 @@ int DFHack::findBitfieldField(const std::string &name, int size, const bitfield_ return -1; } - -#define SIMPLE_GLOBAL(name,tname) \ - tname *df::global::name = NULL; -#define GLOBAL(name,tname) SIMPLE_GLOBAL(name,df::tname) -DF_KNOWN_GLOBALS -#undef GLOBAL -#undef SIMPLE_GLOBAL - -void DFHack::InitDataDefGlobals(Core *core) { - VersionInfo *vinfo = core->vinfo; - void * tmp; - -#define SIMPLE_GLOBAL(name,tname) \ - if (vinfo->getAddress(#name,tmp)) df::global::name = (tname*)tmp; -#define GLOBAL(name,tname) SIMPLE_GLOBAL(name,df::tname) -DF_KNOWN_GLOBALS -#undef GLOBAL -#undef SIMPLE_GLOBAL -} diff --git a/library/DataStatics.cpp b/library/DataStatics.cpp index f47c0fe05..5ccabb7e1 100644 --- a/library/DataStatics.cpp +++ b/library/DataStatics.cpp @@ -1,6 +1,7 @@ #include "Internal.h" #include "DataDefs.h" #include "MiscUtils.h" +#include "VersionInfo.h" #include "df/world.h" #include "df/world_data.h" @@ -13,6 +14,13 @@ namespace { inline T &_toref(T *&p) { return *p; } } +#define INIT_GLOBAL_FUNCTION_PREFIX \ + DFHack::VersionInfo *global_table_ = DFHack::Core::getInstance().vinfo; \ + void * tmp_; + +#define INIT_GLOBAL_FUNCTION_ITEM(type,name) \ + if (global_table_->getAddress(#name,tmp_)) name = (type*)tmp_; + // Instantiate all the static objects #include "df/static.inc" #include "df/static.enums.inc" diff --git a/library/VersionInfoFactory.cpp b/library/VersionInfoFactory.cpp index c6914583b..58282bae7 100644 --- a/library/VersionInfoFactory.cpp +++ b/library/VersionInfoFactory.cpp @@ -122,7 +122,7 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem) { const char *cstr_key = pMemEntry->Attribute("key"); if(!cstr_key) - throw Error::MemoryXmlUnderspecifiedEntry(cstr_key); + throw Error::MemoryXmlUnderspecifiedEntry(cstr_name); const char *cstr_value = pMemEntry->Attribute("value"); if(!cstr_value) throw Error::MemoryXmlUnderspecifiedEntry(cstr_name); diff --git a/library/include/DataDefs.h b/library/include/DataDefs.h index 1e72e9a1f..7ef64ef5e 100644 --- a/library/include/DataDefs.h +++ b/library/include/DataDefs.h @@ -237,38 +237,8 @@ namespace df #define FOR_ENUM_ITEMS(enum,iter) \ for(df::enum iter = ENUM_FIRST_ITEM(enum); iter <= ENUM_LAST_ITEM(enum); iter = df::enum(1+int(iter))) -namespace df { -#define DF_KNOWN_GLOBALS \ - GLOBAL(cursor,cursor) \ - GLOBAL(selection_rect,selection_rect) \ - GLOBAL(world,world) \ - GLOBAL(ui,ui) \ - GLOBAL(gview,interface) \ - GLOBAL(init,init) \ - GLOBAL(d_init,d_init) \ - SIMPLE_GLOBAL(job_next_id,int) \ - SIMPLE_GLOBAL(ui_look_cursor,int) \ - SIMPLE_GLOBAL(ui_workshop_job_cursor,int) \ - SIMPLE_GLOBAL(ui_building_item_cursor,int) \ - SIMPLE_GLOBAL(ui_workshop_in_add,bool) \ - SIMPLE_GLOBAL(ui_selected_unit,int) \ - SIMPLE_GLOBAL(cur_year,int) \ - SIMPLE_GLOBAL(cur_year_tick,int) \ - GLOBAL(ui_sidebar_menus,ui_sidebar_menus) \ - GLOBAL(ui_build_selector,ui_build_selector) \ - GLOBAL(ui_look_list,ui_look_list) \ - GLOBAL(ui_unit_view_mode, ui_unit_view_mode) \ - GLOBAL(gps, graphic) \ - - -#define SIMPLE_GLOBAL(name,tname) \ - namespace global { extern DFHACK_EXPORT tname *name; } -#define GLOBAL(name,tname) \ - struct tname; SIMPLE_GLOBAL(name,tname) -DF_KNOWN_GLOBALS -#undef GLOBAL -#undef SIMPLE_GLOBAL -} +// Global object pointers +#include "df/global_objects.h" // A couple of headers that have to be included at once #include "df/coord2d.h" diff --git a/library/include/modules/Constructions.h b/library/include/modules/Constructions.h index 9e2150dd6..cc9fef2b1 100644 --- a/library/include/modules/Constructions.h +++ b/library/include/modules/Constructions.h @@ -46,7 +46,7 @@ namespace Constructions struct t_construction { df::coord pos; df::item_type item_type; - int16_t unk; + int16_t item_subtype; int16_t mat_type; int32_t mat_index; df::construction_flags flags; diff --git a/library/include/modules/Engravings.h b/library/include/modules/Engravings.h index 6c80eac7b..d52303f32 100644 --- a/library/include/modules/Engravings.h +++ b/library/include/modules/Engravings.h @@ -49,8 +49,8 @@ struct t_engraving { df::coord pos; df::engraving_flags flags; int8_t tile; - int32_t type; - int16_t subtype; + int32_t art_id; + int16_t art_subid; df::item_quality quality; // Pointer to original object, in case you want to modify it df::engraving *origin; diff --git a/library/include/modules/kitchen.h b/library/include/modules/kitchen.h index a18011390..fab387288 100644 --- a/library/include/modules/kitchen.h +++ b/library/include/modules/kitchen.h @@ -49,7 +49,7 @@ typedef uint8_t t_exclusionType; const unsigned int seedLimit = 400; // a limit on the limits which can be placed on seeds const t_itemSubtype organicSubtype = -1; // seems to fixed const t_exclusionType cookingExclusion = 1; // seems to be fixed -const t_itemType limitType = 0; // used to store limit as an entry in the exclusion list. 0 = BAR +const df::enums::item_type::item_type limitType = df::enums::item_type::BAR; // used to store limit as an entry in the exclusion list. 0 = BAR const t_itemSubtype limitSubtype = 0; // used to store limit as an entry in the exclusion list const t_exclusionType limitExclusion = 4; // used to store limit as an entry in the exclusion list diff --git a/library/modules/Constructions.cpp b/library/modules/Constructions.cpp index 0f371b56a..ac9057075 100644 --- a/library/modules/Constructions.cpp +++ b/library/modules/Constructions.cpp @@ -67,7 +67,7 @@ bool Constructions::copyConstruction(const int32_t index, t_construction &out) out.pos = out.origin->pos; out.item_type = out.origin->item_type; - out.unk = out.origin->anon_1; + out.item_subtype = out.origin->item_subtype; out.mat_type = out.origin->mat_type; out.mat_index = out.origin->mat_index; out.flags = out.origin->flags; diff --git a/library/modules/Engravings.cpp b/library/modules/Engravings.cpp index c7cbd9452..9fc2c3adf 100644 --- a/library/modules/Engravings.cpp +++ b/library/modules/Engravings.cpp @@ -72,8 +72,8 @@ bool Engravings::copyEngraving(const int32_t index, t_engraving &out) out.pos = out.origin->pos; out.flags = out.origin->flags; out.tile = out.origin->tile; - out.type = out.origin->type; - out.subtype = out.origin->subtype; + out.art_id = out.origin->art_id; + out.art_subid = out.origin->art_subid; out.quality = out.origin->quality; return true; } diff --git a/library/xml b/library/xml index 032d4fea9..3b20ecfbf 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 032d4fea9c6b821d258c8a413e56efe274d9572c +Subproject commit 3b20ecfbfcb7b801dbe83b1c22f183ca6085af9e