From acd4adc7ccabbe86a12526a09e1df50f8396a3da Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Thu, 8 Mar 2018 02:28:28 -0600 Subject: [PATCH 01/10] Fix CMake warning about CMP0022 policy being set as "OLD". --- library/CMakeLists.txt | 8 +++----- plugins/stonesense | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 4d4a4e9f1..8b4712c73 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -1,10 +1,8 @@ PROJECT (dfapi) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) # prevent CMake warnings about INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES -IF(CMAKE_VERSION VERSION_GREATER "2.8.12") - CMAKE_POLICY(SET CMP0022 OLD) -ENDIF() +CMAKE_POLICY(SET CMP0022 NEW) ## build options OPTION(BUILD_DEVEL "Install/package files required for development (For SDK)." OFF) @@ -365,7 +363,7 @@ IF(APPLE) ENDIF() TARGET_LINK_LIBRARIES(dfhack protobuf-lite clsocket lua jsoncpp dfhack-version ${PROJECT_LIBS}) -SET_TARGET_PROPERTIES(dfhack PROPERTIES LINK_INTERFACE_LIBRARIES "") +SET_TARGET_PROPERTIES(dfhack PROPERTIES INTERFACE_LINK_LIBRARIES "") TARGET_LINK_LIBRARIES(dfhack-client protobuf-lite clsocket) TARGET_LINK_LIBRARIES(dfhack-run dfhack-client) diff --git a/plugins/stonesense b/plugins/stonesense index 031bf4caa..5482849c5 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 031bf4caafec321dd315202a83539d052ed49d84 +Subproject commit 5482849c52dfac9f8200af3827d16bfb3fabb899 From 4ca12621a237bb216e9d48badf4c39f9433fa4c2 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Thu, 8 Mar 2018 11:38:46 -0600 Subject: [PATCH 02/10] Remove remaining CMP0022 usage --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58be5dff1..17cf86a0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,5 @@ # main project file. use it from a build sub-folder, see COMPILE for details -# prevent CMake warnings about INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES -IF(CMAKE_VERSION VERSION_GREATER "2.8.12") - CMAKE_POLICY(SET CMP0022 OLD) -ENDIF() - # Set up build types if(CMAKE_CONFIGURATION_TYPES) SET(CMAKE_CONFIGURATION_TYPES Release RelWithDebInfo) From 7bbfd456d33b1ad821d424d941d1ff516b407ab3 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Thu, 8 Mar 2018 11:26:14 -0600 Subject: [PATCH 03/10] Fix compile errors on Ubuntu 18.04 Bionic Beaver --- CMakeLists.txt | 1 + depends/jsoncpp/jsoncpp.cpp | 2 ++ library/MiscUtils.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58be5dff1..d4bba06d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,7 @@ IF(UNIX) # ensure compatibility with older CPUs # enable C++11 features add_definitions(-DLINUX_BUILD) + add_definitions(-D_GLIBCXX_USE_C99) SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic -std=c++0x") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic") diff --git a/depends/jsoncpp/jsoncpp.cpp b/depends/jsoncpp/jsoncpp.cpp index eb38217ef..009d04e7a 100644 --- a/depends/jsoncpp/jsoncpp.cpp +++ b/depends/jsoncpp/jsoncpp.cpp @@ -3922,8 +3922,10 @@ Value& Path::make(Value& root) const { #define isfinite finite #else #include +#ifndef isfinite // fix isfinite on Ubuntu 18.04 #define isfinite std::isfinite #endif +#endif #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #define snprintf _snprintf diff --git a/library/MiscUtils.cpp b/library/MiscUtils.cpp index e350cb9ec..91a860991 100644 --- a/library/MiscUtils.cpp +++ b/library/MiscUtils.cpp @@ -36,6 +36,7 @@ distribution. #include #include #include +#include #include #include From c260996d6186b9386f6dfa820df33fcc1ca7f99d Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Thu, 8 Mar 2018 12:26:10 -0600 Subject: [PATCH 04/10] Update required CMake version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17cf86a0b..bb3ab92cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ endif(CMAKE_CONFIGURATION_TYPES) OPTION(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF) ## some generic CMake magic -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) project(dfhack) macro(CHECK_GCC COMPILER_PATH) From f2ff609e1c04d629e79da11d98caba7d2e43ef91 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 10 Mar 2018 16:18:15 -0500 Subject: [PATCH 05/10] Initial 0.44.06 support, update xml --- CMakeLists.txt | 8 +++++--- library/include/df/custom/creature_handler.methods.inc | 1 + library/xml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 library/include/df/custom/creature_handler.methods.inc diff --git a/CMakeLists.txt b/CMakeLists.txt index 58be5dff1..d8d35f450 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,12 +140,14 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac endif() # set up versioning. -set(DF_VERSION "0.44.05") -set(DFHACK_RELEASE "r2") -set(DFHACK_PRERELEASE FALSE) +set(DF_VERSION "0.44.06") +set(DFHACK_RELEASE "alpha0") +set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") +set(DFHACK_ABI_VERSION 1) + ## where to install things (after the build is done, classic 'make install' or package structure) # the dfhack libraries will be installed here: IF(UNIX) diff --git a/library/include/df/custom/creature_handler.methods.inc b/library/include/df/custom/creature_handler.methods.inc new file mode 100644 index 000000000..811128d05 --- /dev/null +++ b/library/include/df/custom/creature_handler.methods.inc @@ -0,0 +1 @@ +friend struct world_raws; diff --git a/library/xml b/library/xml index 2794f8a6d..a6297f128 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 2794f8a6d7405d4858bac486a0bb17b94740c142 +Subproject commit a6297f128686407819fb7fe1e1fddd96606f30a0 From db95796d4c634f09e162f17f14f1b692919f5994 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 10 Mar 2018 16:53:45 -0500 Subject: [PATCH 06/10] Many build fixes --- library/lua/dfhack/workshops.lua | 4 ++-- library/modules/Materials.cpp | 8 +++---- library/xml | 2 +- plugins/add-spatter.cpp | 2 +- plugins/devel/dumpmats.cpp | 10 ++++----- plugins/dwarfmonitor.cpp | 4 ++-- plugins/embark-assistant/survey.cpp | 2 +- plugins/eventful.cpp | 2 +- plugins/labormanager/joblabormapper.cpp | 12 +++++----- plugins/lua/stockflow.lua | 4 ++-- plugins/lua/workflow.lua | 2 +- plugins/remotefortressreader/item_reader.cpp | 6 ++--- .../remotefortressreader.cpp | 22 +++++++++---------- scripts | 2 +- 14 files changed, 41 insertions(+), 41 deletions(-) diff --git a/library/lua/dfhack/workshops.lua b/library/lua/dfhack/workshops.lua index 09268ff38..a09849a57 100644 --- a/library/lua/dfhack/workshops.lua +++ b/library/lua/dfhack/workshops.lua @@ -476,7 +476,7 @@ local function matchIds(bid1,wid1,cid1,bid2,wid2,cid2) end local function scanRawsReaction(buildingId,workshopId,customId) local ret={} - for idx,reaction in ipairs(df.global.world.raws.reactions) do + for idx,reaction in ipairs(df.global.world.raws.reactions.reactions) do for k,v in pairs(reaction.building.type) do if matchIds(buildingId,workshopId,customId,v,reaction.building.subtype[k],reaction.building.custom[k]) then table.insert(ret,reaction) @@ -575,4 +575,4 @@ function getJobs(buildingId,workshopId,customId) --get jobs, add in from raws return ret end -return _ENV \ No newline at end of file +return _ENV diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 219932657..a8f10d7d2 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -733,7 +733,7 @@ bool Materials::ReadOthers(void) bool Materials::ReadDescriptorColors (void) { - size_t size = world->raws.language.colors.size(); + size_t size = world->raws.descriptors.colors.size(); color.clear(); if(size == 0) @@ -741,7 +741,7 @@ bool Materials::ReadDescriptorColors (void) color.reserve(size); for (size_t i = 0; i < size;i++) { - df::descriptor_color *c = world->raws.language.colors[i]; + df::descriptor_color *c = world->raws.descriptors.colors[i]; t_descriptor_color col; col.id = c->id; col.name = c->name; @@ -751,13 +751,13 @@ bool Materials::ReadDescriptorColors (void) color.push_back(col); } - size = world->raws.language.patterns.size(); + size = world->raws.descriptors.patterns.size(); alldesc.clear(); alldesc.reserve(size); for (size_t i = 0; i < size;i++) { t_matgloss mat; - mat.id = world->raws.language.patterns[i]->id; + mat.id = world->raws.descriptors.patterns[i]->id; alldesc.push_back(mat); } return true; diff --git a/library/xml b/library/xml index a6297f128..2e97088b1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit a6297f128686407819fb7fe1e1fddd96606f30a0 +Subproject commit 2e97088b1b573ff8f1a6e73b3478838ec8c32b41 diff --git a/plugins/add-spatter.cpp b/plugins/add-spatter.cpp index 1e835b8b6..3d2d89dd1 100644 --- a/plugins/add-spatter.cpp +++ b/plugins/add-spatter.cpp @@ -356,7 +356,7 @@ static bool find_reactions(color_ostream &out) reactions.clear(); products.clear(); - auto &rlist = world->raws.reactions; + auto &rlist = df::reaction::get_vector(); for (size_t i = 0; i < rlist.size(); i++) { diff --git a/plugins/devel/dumpmats.cpp b/plugins/devel/dumpmats.cpp index e50771a9f..23c7be4e1 100644 --- a/plugins/devel/dumpmats.cpp +++ b/plugins/devel/dumpmats.cpp @@ -59,10 +59,10 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) { def_color[matter_state::Liquid] = solid_color; def_color[matter_state::Gas] = solid_color; - out.print("\t[STATE_COLOR:ALL:%s]\n", world->raws.language.colors[solid_color]->id.c_str()); + out.print("\t[STATE_COLOR:ALL:%s]\n", world->raws.descriptors.colors[solid_color]->id.c_str()); } else - out.print("\t[STATE_COLOR:ALL_SOLID:%s]\n", world->raws.language.colors[solid_color]->id.c_str()); + out.print("\t[STATE_COLOR:ALL_SOLID:%s]\n", world->raws.descriptors.colors[solid_color]->id.c_str()); } string solid_name = mat->state_name[matter_state::Solid]; @@ -141,7 +141,7 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) FOR_ENUM_ITEMS(matter_state, state) { if (mat->state_color[state] != -1 && mat->state_color[state] != def_color[state]) - out.print("\t[STATE_COLOR:%s:%s]\n", state_names[state], world->raws.language.colors[mat->state_color[state]]->id.c_str()); + out.print("\t[STATE_COLOR:%s:%s]\n", state_names[state], world->raws.descriptors.colors[mat->state_color[state]]->id.c_str()); if (mat->state_name[state] == mat->state_adj[state]) { if (mat->state_name[state].size() && mat->state_name[state] != def_name[state] || mat->state_adj[state].size() && mat->state_adj[state] != def_adj[state]) @@ -241,7 +241,7 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) if (mat->hardens_with_water.mat_type != -1) out.print("\t[HARDENS_WITH_WATER:%s:%s%s%s]\n", mat->hardens_with_water.str[0].c_str(), mat->hardens_with_water.str[1].c_str(), mat->hardens_with_water.str[2].size() ? ":" : "", mat->hardens_with_water.str[2].c_str()); if (mat->powder_dye != -1) - out.print("\t[POWDER_DYE:%s]\n", world->raws.language.colors[mat->powder_dye]->id.c_str()); + out.print("\t[POWDER_DYE:%s]\n", world->raws.descriptors.colors[mat->powder_dye]->id.c_str()); if (mat->soap_level != -0) out.print("\t[SOAP_LEVEL:%o]\n", mat->soap_level); @@ -262,4 +262,4 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector DFhackCExport command_result plugin_shutdown ( Core * c ) { return CR_OK; -} \ No newline at end of file +} diff --git a/plugins/dwarfmonitor.cpp b/plugins/dwarfmonitor.cpp index bf7c02efc..56ca53091 100644 --- a/plugins/dwarfmonitor.cpp +++ b/plugins/dwarfmonitor.cpp @@ -1303,7 +1303,7 @@ struct preference_map } case (T_type::LikeShape): - label += "Shape :" + raws.language.shapes[pref.shape_id]->name_plural; + label += "Shape :" + raws.descriptors.shapes[pref.shape_id]->name_plural; break; case (T_type::LikeTree): @@ -1314,7 +1314,7 @@ struct preference_map } case (T_type::LikeColor): - label += "Color :" + raws.language.colors[pref.color_id]->name; + label += "Color :" + raws.descriptors.colors[pref.color_id]->name; break; case (T_type::LikePoeticForm): diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index 6583d2479..5df070303 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -74,7 +74,7 @@ namespace embark_assist { bool geo_survey(embark_assist::defs::geo_data *geo_summary) { color_ostream_proxy out(Core::getInstance().getConsole()); df::world_data *world_data = world->world_data; - auto reactions = world->raws.reactions; + auto reactions = df::reaction::get_vector(); bool non_soil_found; uint16_t size; diff --git a/plugins/eventful.cpp b/plugins/eventful.cpp index 365542314..f4056a3d5 100644 --- a/plugins/eventful.cpp +++ b/plugins/eventful.cpp @@ -397,7 +397,7 @@ static bool find_reactions(color_ostream &out) { reactions.clear(); - auto &rlist = world->raws.reactions; + auto &rlist = df::reaction::get_vector(); for (size_t i = 0; i < rlist.size(); i++) { diff --git a/plugins/labormanager/joblabormapper.cpp b/plugins/labormanager/joblabormapper.cpp index 779839e99..f47077134 100644 --- a/plugins/labormanager/joblabormapper.cpp +++ b/plugins/labormanager/joblabormapper.cpp @@ -583,11 +583,11 @@ class jlfunc_custom : public jlfunc public: df::unit_labor get_labor(df::job* j) { - for (auto r = world->raws.reactions.begin(); r != world->raws.reactions.end(); r++) + for (auto r : df::reaction::get_vector()) { - if ((*r)->code == j->reaction_name) + if (r->code == j->reaction_name) { - df::job_skill skill = (*r)->skill; + df::job_skill skill = r->skill; df::unit_labor labor = ENUM_ATTR(job_skill, labor, skill); return labor; } @@ -894,11 +894,11 @@ df::unit_labor JobLaborMapper::find_job_labor(df::job* j) { if (j->job_type == df::job_type::CustomReaction) { - for (auto r = world->raws.reactions.begin(); r != world->raws.reactions.end(); r++) + for (auto r : df::reaction::get_vector()) { - if ((*r)->code == j->reaction_name) + if (r->code == j->reaction_name) { - df::job_skill skill = (*r)->skill; + df::job_skill skill = r->skill; return ENUM_ATTR(job_skill, labor, skill); } } diff --git a/plugins/lua/stockflow.lua b/plugins/lua/stockflow.lua index fcaca0ecd..ca484d831 100644 --- a/plugins/lua/stockflow.lua +++ b/plugins/lua/stockflow.lua @@ -416,13 +416,13 @@ function collect_reactions() end for _, reaction_id in ipairs(entity.entity_raw.workshops.permitted_reaction_id) do - local reaction = df.global.world.raws.reactions[reaction_id] + local reaction = df.global.world.raws.reactions.reactions[reaction_id] local name = string.gsub(reaction.name, "^.", string.upper) reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name) end -- Reactions generated by the game. - for _, reaction in ipairs(df.global.world.raws.reactions) do + for _, reaction in ipairs(df.global.world.raws.reactions.reactions) do if reaction.source_enid == entity.id then local name = string.gsub(reaction.name, "^.", string.upper) reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name) diff --git a/plugins/lua/workflow.lua b/plugins/lua/workflow.lua index dcec1248d..6c4230a51 100644 --- a/plugins/lua/workflow.lua +++ b/plugins/lua/workflow.lua @@ -29,7 +29,7 @@ end local function get_reaction(name) if not reaction_id_cache then reaction_id_cache = {} - for i,v in ipairs(df.global.world.raws.reactions) do + for i,v in ipairs(df.global.world.raws.reactions.reactions) do reaction_id_cache[v.code] = i end end diff --git a/plugins/remotefortressreader/item_reader.cpp b/plugins/remotefortressreader/item_reader.cpp index 59b1f36e7..5bfccbfad 100644 --- a/plugins/remotefortressreader/item_reader.cpp +++ b/plugins/remotefortressreader/item_reader.cpp @@ -221,7 +221,7 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem) case df::enums::item_type::STATUE: { VIRTUAL_CAST_VAR(statue, df::item_statuest, DfItem); - + df::art_image_chunk * chunk = NULL; GET_ART_IMAGE_CHUNK GetArtImageChunk = reinterpret_cast(Core::getInstance().vinfo->getAddress("get_art_image_chunk")); if (GetArtImageChunk) @@ -518,9 +518,9 @@ DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack:: case df::enums::item_type::GEM: case df::enums::item_type::SMALLGEM: { - for (int i = 0; i < world->raws.language.shapes.size(); i++) + for (int i = 0; i < world->raws.descriptors.shapes.size(); i++) { - auto shape = world->raws.language.shapes[i]; + auto shape = world->raws.descriptors.shapes[i]; if (shape->gems_use.whole == 0) continue; mat_def = out->add_material_list(); diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index e321bf8d5..197c4bd6a 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -384,7 +384,7 @@ void ConvertDfColor(int16_t in[3], RemoteFortressReader::ColorDefinition * out) void ConvertDFColorDescriptor(int16_t index, RemoteFortressReader::ColorDefinition * out) { - df::descriptor_color *color = world->raws.language.colors[index]; + df::descriptor_color *color = world->raws.descriptors.colors[index]; out->set_red(color->red * 255); out->set_green(color->green * 255); out->set_blue(color->blue * 255); @@ -859,7 +859,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(i); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (raws->inorganics[i]->material.state_color[GetState(&raws->inorganics[i]->material)] < raws->language.colors.size()) + if (raws->inorganics[i]->material.state_color[GetState(&raws->inorganics[i]->material)] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(raws->inorganics[i]->material.state_color[GetState(&raws->inorganics[i]->material)], mat_def->mutable_state_color()); } @@ -877,7 +877,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(j); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (raws->mat_table.builtin[i]->state_color[GetState(raws->mat_table.builtin[i])] < raws->language.colors.size()) + if (raws->mat_table.builtin[i]->state_color[GetState(raws->mat_table.builtin[i])] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(raws->mat_table.builtin[i]->state_color[GetState(raws->mat_table.builtin[i])], mat_def->mutable_state_color()); } @@ -894,7 +894,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(i); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->language.colors.size()) + if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(creature->material[j]->state_color[GetState(creature->material[j])], mat_def->mutable_state_color()); } @@ -916,9 +916,9 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage // id << "HF" << i << mat.getToken(); // mat_def->set_id(id.str()); // mat_def->set_name(mat.toString()); //find the name at cave temperature; - // if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->language.colors.size()) + // if (creature->material[j]->state_color[GetState(creature->material[j])] < raws->descriptors.colors.size()) // { - // df::descriptor_color *color = raws->language.colors[creature->material[j]->state_color[GetState(creature->material[j])]]; + // df::descriptor_color *color = raws->descriptors.colors[creature->material[j]->state_color[GetState(creature->material[j])]]; // mat_def->mutable_state_color()->set_red(color->red * 255); // mat_def->mutable_state_color()->set_green(color->green * 255); // mat_def->mutable_state_color()->set_blue(color->blue * 255); @@ -936,7 +936,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage mat_def->mutable_mat_pair()->set_mat_index(i); mat_def->set_id(mat.getToken()); mat_def->set_name(mat.toString()); //find the name at cave temperature; - if (plant->material[j]->state_color[GetState(plant->material[j])] < raws->language.colors.size()) + if (plant->material[j]->state_color[GetState(plant->material[j])] < raws->descriptors.colors.size()) { ConvertDFColorDescriptor(plant->material[j]->state_color[GetState(plant->material[j])], mat_def->mutable_state_color()); } @@ -2683,13 +2683,13 @@ static command_result GetPartialCreatureRaws(color_ostream &stream, const ListRe for (int l = 0; l < orig_mod->pattern_index.size(); l++) { - auto orig_pattern = world->raws.language.patterns[orig_mod->pattern_index[l]]; + auto orig_pattern = world->raws.descriptors.patterns[orig_mod->pattern_index[l]]; auto send_pattern = send_mod->add_patterns(); for (int m = 0; m < orig_pattern->colors.size(); m++) { auto send_color = send_pattern->add_colors(); - auto orig_color = world->raws.language.colors[orig_pattern->colors[m]]; + auto orig_color = world->raws.descriptors.colors[orig_pattern->colors[m]]; send_color->set_red(orig_color->red * 255.0); send_color->set_green(orig_color->green * 255.0); send_color->set_blue(orig_color->blue * 255.0); @@ -2980,9 +2980,9 @@ static command_result GetLanguage(color_ostream & stream, const EmptyMessage * i if (!world) return CR_FAILURE; - for (int i = 0; i < world->raws.language.shapes.size(); i++) + for (int i = 0; i < world->raws.descriptors.shapes.size(); i++) { - auto shape = world->raws.language.shapes[i]; + auto shape = world->raws.descriptors.shapes[i]; auto netShape = out->add_shapes(); netShape->set_id(shape->id); netShape->set_tile(shape->tile); diff --git a/scripts b/scripts index 9d8f2096f..7935e1bef 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 9d8f2096fc4c247299cbc94c6a8d756f31690a4b +Subproject commit 7935e1befd9d3009bf833829c4f5e0e8acb0c65b From eb22d5c38eefef4d3af5881ae8fec60f82c657d0 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 10 Mar 2018 16:55:00 -0500 Subject: [PATCH 07/10] Add ABI version symbol to plugins --- library/CMakeLists.txt | 1 + library/DFHackVersion.cpp | 4 ++++ library/PluginManager.cpp | 9 +++++++++ library/include/DFHackVersion.h | 2 ++ library/include/PluginManager.h | 2 ++ 5 files changed, 18 insertions(+) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 4d4a4e9f1..9171c59f0 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -301,6 +301,7 @@ SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS DFHACK_VERSION="${DFHACK_VERSION}" DF_VERSION="${DF_VERSION}" DFHACK_RELEASE="${DFHACK_RELEASE}" + DFHACK_ABI_VERSION=${DFHACK_ABI_VERSION} ) IF(DFHACK_PRERELEASE) SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS diff --git a/library/DFHackVersion.cpp b/library/DFHackVersion.cpp index 9d367ae64..f4f0cf242 100644 --- a/library/DFHackVersion.cpp +++ b/library/DFHackVersion.cpp @@ -3,6 +3,10 @@ #include "git-describe.h" namespace DFHack { namespace Version { + int dfhack_abi_version() + { + return DFHACK_ABI_VERSION; + } const char *dfhack_version() { return DFHACK_VERSION; diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index b6d1dcc92..8e3f436cb 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -276,6 +276,7 @@ bool Plugin::load(color_ostream &con) plugin_check_symbol("plugin_name") plugin_check_symbol("plugin_version") + plugin_check_symbol("plugin_abi_version") plugin_check_symbol("plugin_self") plugin_check_symbol("plugin_init") plugin_check_symbol("plugin_globals") @@ -287,11 +288,19 @@ bool Plugin::load(color_ostream &con) return false; } const char ** plug_version =(const char ** ) LookupPlugin(plug, "plugin_version"); + const int *plugin_abi_version = (int*) LookupPlugin(plug, "plugin_abi_version"); const char ** plug_git_desc_ptr = (const char**) LookupPlugin(plug, "plugin_git_description"); Plugin **plug_self = (Plugin**)LookupPlugin(plug, "plugin_self"); const char *dfhack_version = Version::dfhack_version(); const char *dfhack_git_desc = Version::git_description(); const char *plug_git_desc = plug_git_desc_ptr ? *plug_git_desc_ptr : "unknown"; + if (*plugin_abi_version != Version::dfhack_abi_version()) + { + con.printerr("Plugin %s: ABI version mismatch (Plugin: %i, DFHack: %i)\n", + *plug_name, *plugin_abi_version, Version::dfhack_abi_version()); + plugin_abort_load; + return false; + } if (strcmp(dfhack_version, *plug_version) != 0) { con.printerr("Plugin %s was not built for this version of DFHack.\n" diff --git a/library/include/DFHackVersion.h b/library/include/DFHackVersion.h index afe8a03a0..c89b94ba5 100644 --- a/library/include/DFHackVersion.h +++ b/library/include/DFHackVersion.h @@ -4,6 +4,7 @@ namespace DFHack { const char *dfhack_version(); const char *df_version(); const char *dfhack_release(); + int dfhack_abi_version(); const char *git_description(); const char *git_commit(); const char *git_xml_commit(); @@ -18,6 +19,7 @@ namespace DFHack { #define DF_VERSION (DFHack::Version::df_version()) #define DFHACK_RELEASE (DFHack::Version::dfhack_release()) #define DFHACK_VERSION (DFHack::Version::dfhack_version()) + #define DFHACK_ABI_VERSION (DFHack::Version::dfhack_abi_version()) #define DFHACK_GIT_DESCRIPTION (DFHack::Version::git_description()) #define DFHACK_GIT_COMMIT (DFHack::Version::git_commit()) #define DFHACK_GIT_XML_COMMIT (DFHack::Version::git_xml_commit()) diff --git a/library/include/PluginManager.h b/library/include/PluginManager.h index f7a8a7d87..c8776d8ed 100644 --- a/library/include/PluginManager.h +++ b/library/include/PluginManager.h @@ -61,6 +61,7 @@ namespace DFHack namespace Version { const char *dfhack_version(); const char *git_description(); + int dfhack_abi_version(); } // anon type, pretty much @@ -296,6 +297,7 @@ namespace DFHack DFhackDataExport const char * plugin_name = m_plugin_name;\ DFhackDataExport const char * plugin_version = DFHack::Version::dfhack_version();\ DFhackDataExport const char * plugin_git_description = DFHack::Version::git_description();\ + DFhackDataExport int plugin_abi_version = DFHack::Version::dfhack_abi_version();\ DFhackDataExport DFHack::Plugin *plugin_self = NULL;\ std::vector _plugin_globals;\ DFhackDataExport std::vector* plugin_globals = &_plugin_globals; \ From 0ccc89a5fedeb3b0bcca76ec7eeb2e2d688600a4 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 10 Mar 2018 16:55:20 -0500 Subject: [PATCH 08/10] Make git-describe.cmake detect changes to itself --- library/git-describe.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/git-describe.cmake b/library/git-describe.cmake index bdde32ef9..f19b556d2 100644 --- a/library/git-describe.cmake +++ b/library/git-describe.cmake @@ -7,7 +7,8 @@ set(git_describe_h ${dfhack_SOURCE_DIR}/library/include/git-describe.h) if(EXISTS ${git_describe_tmp_h} AND NOT(${dfhack_SOURCE_DIR}/.git/index IS_NEWER_THAN ${git_describe_tmp_h}) AND - NOT(${dfhack_SOURCE_DIR}/.git/modules/library/xml/index IS_NEWER_THAN ${git_describe_tmp_h})) + NOT(${dfhack_SOURCE_DIR}/.git/modules/library/xml/index IS_NEWER_THAN ${git_describe_tmp_h}) AND + NOT(${dfhack_SOURCE_DIR}/library/git-describe.cmake IS_NEWER_THAN ${git_describe_tmp_h})) return() endif() From 25d29384777410deedbc2a613c1565c7957d39ac Mon Sep 17 00:00:00 2001 From: Warmist Date: Sun, 11 Mar 2018 12:40:30 +0200 Subject: [PATCH 09/10] Fix parse_inset in gui.lua It was used in different order than the return happened. --- library/lua/gui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/lua/gui.lua b/library/lua/gui.lua index 3a829c529..fb125e690 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -105,7 +105,7 @@ local function parse_inset(inset) l = inset or 0 t,r,b = l,l,l end - return l,r,t,b + return l,t,r,b end function inset_frame(rect, inset, gap) From 40654954a1c9593deda3c5459a02054aa7ef0974 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Tue, 13 Mar 2018 15:49:42 -0500 Subject: [PATCH 10/10] Partial preparation for 0.44.07-alpha1. Still need to write release notes and add tags. --- CMakeLists.txt | 4 ++-- library/xml | 2 +- plugins/isoworld | 2 +- plugins/stonesense | 2 +- scripts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0a3f774a..848b3eee6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,8 +135,8 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac endif() # set up versioning. -set(DF_VERSION "0.44.06") -set(DFHACK_RELEASE "alpha0") +set(DF_VERSION "0.44.07") +set(DFHACK_RELEASE "alpha1") set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") diff --git a/library/xml b/library/xml index 2e97088b1..dd558ca1e 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 2e97088b1b573ff8f1a6e73b3478838ec8c32b41 +Subproject commit dd558ca1ea4645f14a7e5b83329d4f59d8414496 diff --git a/plugins/isoworld b/plugins/isoworld index 3ff3f05da..fbbf9e464 160000 --- a/plugins/isoworld +++ b/plugins/isoworld @@ -1 +1 @@ -Subproject commit 3ff3f05da53077dd9e67c1eef672427a2bfd95ea +Subproject commit fbbf9e46458e41707c27f2a4438452a579490db1 diff --git a/plugins/stonesense b/plugins/stonesense index 5482849c5..4c3728880 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 5482849c52dfac9f8200af3827d16bfb3fabb899 +Subproject commit 4c3728880a1b8d94046283be28d2078aac9fbe05 diff --git a/scripts b/scripts index 7935e1bef..be21a2a52 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 7935e1befd9d3009bf833829c4f5e0e8acb0c65b +Subproject commit be21a2a52084e838e4b5eb1f296a03d5592389f8