From b05aaea07a2c3fc6cb4556f77743f6f9ae9fe1b2 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:16:23 +0000 Subject: [PATCH 01/27] Auto-update submodules scripts: master plugins/stonesense: master --- plugins/stonesense | 2 +- scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/stonesense b/plugins/stonesense index 1f44869579..6313c3c778 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 1f44869579a4bb95ef0391ab0eae2e8233d60399 +Subproject commit 6313c3c77876c320548851646928904df6400e44 diff --git a/scripts b/scripts index ce3edb4243..a8e61195dc 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit ce3edb42438fabbe28fe9680bbc28846f709ebc5 +Subproject commit a8e61195dc42162aff48eb7e7a14118c41ab4dcd From 072a5ea036c43aa2e511434afc939f42e6217236 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 14 Jan 2025 08:56:32 +0000 Subject: [PATCH 02/27] Auto-update submodules plugins/stonesense: master --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index 6313c3c778..259e37afe5 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 6313c3c77876c320548851646928904df6400e44 +Subproject commit 259e37afe5eb95e21098d3a030e55e45ea1cd24d From 392d362e0bcdf806dcf480981dfa18cbfe428bf4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 14 Jan 2025 02:26:57 -0800 Subject: [PATCH 03/27] output proper error messages when plugin operations fail --- library/Core.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index cddc76dbd5..94a94d748c 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -799,30 +799,35 @@ command_result Core::runCommand(color_ostream &con, const std::string &first_, s all = true; } } + auto ret = CR_OK; if (all) { - if (load) - plug_mgr->loadAll(); - else if (unload) - plug_mgr->unloadAll(); - else - plug_mgr->reloadAll(); - return CR_OK; + if (load && !plug_mgr->loadAll()) + ret = CR_FAILURE; + else if (unload && !plug_mgr->unloadAll()) + ret = CR_FAILURE; + else if (!plug_mgr->reloadAll()) + ret = CR_FAILURE; } for (auto p = parts.begin(); p != parts.end(); p++) { if (!p->size() || (*p)[0] == '-') continue; - if (load) - plug_mgr->load(*p); - else if (unload) - plug_mgr->unload(*p); - else - plug_mgr->reload(*p); + if (load && !plug_mgr->load(*p)) + ret = CR_FAILURE; + else if (unload && !plug_mgr->unload(*p)) + ret = CR_FAILURE; + else if (!plug_mgr->reload(*p)) + ret = CR_FAILURE; } + if (ret != CR_OK) + con.printerr("%s failed\n", first.c_str()); + return ret; } - else + else { con.printerr("%s: no arguments\n", first.c_str()); + return CR_FAILURE; + } } else if( first == "enable" || first == "disable" ) { From 89dd43c709c5e09317c9cc04906a891bee6c6430 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 14 Jan 2025 02:37:25 -0800 Subject: [PATCH 04/27] update stonesense ref --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index 259e37afe5..13c215ce77 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 259e37afe5eb95e21098d3a030e55e45ea1cd24d +Subproject commit 13c215ce77ba607c2e98dc4e629937e213d76f77 From a9bd49393f4fc2a12bd5bbfc6df70f0c3022ae2e Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 14 Jan 2025 12:12:56 -0600 Subject: [PATCH 05/27] remove obsolete `t_building` this obsolete type is a leftover from DFHack's out of process days, vastly out of date and useless today... except in stonesense, which now has it locally (as `Stonesense_Building`) --- library/include/modules/Buildings.h | 33 ----------------------------- library/modules/Buildings.cpp | 18 ---------------- plugins/stonesense | 2 +- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/library/include/modules/Buildings.h b/library/include/modules/Buildings.h index 6702999552..ee7fcdf698 100644 --- a/library/include/modules/Buildings.h +++ b/library/include/modules/Buildings.h @@ -58,34 +58,6 @@ class color_ostream; namespace Buildings { -/** - * Structure for holding a read DF building object - * \ingroup grp_buildings - */ -struct t_building -{ - uint32_t x1; - uint32_t y1; - uint32_t x2; - uint32_t y2; - uint32_t z; - t_matglossPair material; - df::building_type type; - union - { - int16_t subtype; - df::civzone_type civzone_type; - df::furnace_type furnace_type; - df::workshop_type workshop_type; - df::construction_type construction_type; - df::shop_type shop_type; - df::siegeengine_type siegeengine_type; - df::trap_type trap_type; - }; - int32_t custom_type; - df::building * origin; -}; - /** * The Buildings module - allows reading DF buildings * \ingroup grp_modules @@ -93,11 +65,6 @@ struct t_building */ DFHACK_EXPORT uint32_t getNumBuildings (); -/** - * read building by index - */ -DFHACK_EXPORT bool Read (const uint32_t index, t_building & building); - /** * read mapping from custom_type value to building RAW name * custom_type of -1 implies ordinary building diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index b911d82e2e..a560a6fc99 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -278,24 +278,6 @@ uint32_t Buildings::getNumBuildings() return world->buildings.all.size(); } -bool Buildings::Read (const uint32_t index, t_building & building) -{ - df::building *bld = world->buildings.all[index]; - - building.x1 = bld->x1; - building.x2 = bld->x2; - building.y1 = bld->y1; - building.y2 = bld->y2; - building.z = bld->z; - building.material.index = bld->mat_index; - building.material.type = bld->mat_type; - building.type = bld->getType(); - building.subtype = bld->getSubtype(); - building.custom_type = bld->getCustomType(); - building.origin = bld; - return true; -} - bool Buildings::ReadCustomWorkshopTypes(map & btypes) { vector & bld_def = world->raws.buildings.all; diff --git a/plugins/stonesense b/plugins/stonesense index 13c215ce77..b39e81f63b 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 13c215ce77ba607c2e98dc4e629937e213d76f77 +Subproject commit b39e81f63be8b66f9feaa845f55a2792caed5ac4 From bfa81a7a7c0c09b795e30628a0f30f7b75d9f301 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 14 Jan 2025 19:32:18 -0800 Subject: [PATCH 06/27] DF testing branch has been removed remove corresponding monitoring --- .github/workflows/watch-df-steam.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/watch-df-steam.yml b/.github/workflows/watch-df-steam.yml index 4772e94250..7be4702cfa 100644 --- a/.github/workflows/watch-df-steam.yml +++ b/.github/workflows/watch-df-steam.yml @@ -25,9 +25,6 @@ jobs: structures_ref: adv-beta dfhack_ref: adv-beta steam_branch: adventure-beta - - df_steam_branch: testing - structures_ref: testing - dfhack_ref: testing steps: - name: Fetch state uses: actions/cache/restore@v4 From a8479e31563bbb2357e5f95c9d270de8eeb19359 Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 11:07:30 -0600 Subject: [PATCH 07/27] add the code to get the millis count millis count is now noted on load and save. --- library/LuaApi.cpp | 2 ++ library/include/modules/Persistence.h | 2 ++ library/modules/Persistence.cpp | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index d25afb1270..97a5b216bd 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1343,6 +1343,7 @@ static string getArchitectureName() static string getDFVersion() { return Core::getInstance().vinfo->getVersion(); } static uint32_t getTickCount() { return Core::getInstance().p->getTickCount(); } +static uint32_t getCurSaveDur() { return Persistence::getSaveDur(); } static string getDFPath() { return Core::getInstance().p->getPath(); } static string getHackPath() { return Core::getInstance().getHackPath(); } @@ -1370,6 +1371,7 @@ static const LuaWrapper::FunctionReg dfhack_module[] = { WRAP(getDFVersion), WRAP(getDFPath), WRAP(getTickCount), + WRAP(getCurSaveDur), WRAP(getHackPath), WRAP(isWorldLoaded), WRAP(isMapLoaded), diff --git a/library/include/modules/Persistence.h b/library/include/modules/Persistence.h index b01f8c136d..a2ded42754 100644 --- a/library/include/modules/Persistence.h +++ b/library/include/modules/Persistence.h @@ -213,5 +213,7 @@ namespace DFHack // Fills the vector with references to each persistent item with a key that is // equal to the given key. DFHACK_EXPORT void getAllByKey(std::vector &vec, int entity_id, const std::string &key); + // Returns the tickcount of the most recent save. + DFHACK_EXPORT uint32_t getSaveDur(); } } diff --git a/library/modules/Persistence.cpp b/library/modules/Persistence.cpp index 2e6dd19f6c..36a9770f55 100644 --- a/library/modules/Persistence.cpp +++ b/library/modules/Persistence.cpp @@ -49,6 +49,8 @@ using namespace DFHack; static std::unordered_map>> store; static std::unordered_map> entry_cache; +static uint32_t lastTickCount = 0; + size_t next_entry_id = 0; // goes more positive int next_fake_df_id = -101; // goes more negative @@ -198,6 +200,7 @@ void Persistence::Internal::save(color_ostream& out) { CoreSuspender suspend; // write status + lastTickCount = Core::getInstance().p->getTickCount(); { auto file = std::ofstream(getSaveFilePath("current", "status")); file << "DF version: " << core.p->getDescriptor()->getVersion() << std::endl; @@ -307,6 +310,7 @@ void Persistence::Internal::load(color_ostream& out) { } if (found) + lastTickCount = Core::getInstance().p->getTickCount(); return; // new file formats not found; attempt to load legacy file @@ -417,3 +421,8 @@ void Persistence::getAllByKey(std::vector &vec, int entity_i for (auto it = range.first; it != range.second; ++it) vec.emplace_back(it->second); } + +uint32_t Persistence::getSaveDur() { + uint32_t durMS = Core::getInstance().p->getTickCount() - lastTickCount; + return durMS / (60 * 1000); +} From 8396d6105174f139c28bedb2b993e1b21f3dbdeb Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:46:14 +0000 Subject: [PATCH 08/27] Auto-update submodules plugins/stonesense: master --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index b39e81f63b..6ff89be8cd 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit b39e81f63be8b66f9feaa845f55a2792caed5ac4 +Subproject commit 6ff89be8cd79787ac32ebafc071a6cdeadad878a From 37e4ed099541b79db62639de075bb8c3fed0ea6f Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:12:36 -0600 Subject: [PATCH 09/27] give things better names and code locations --- library/include/modules/Persistence.h | 2 +- library/modules/Persistence.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/include/modules/Persistence.h b/library/include/modules/Persistence.h index a2ded42754..748994c4bb 100644 --- a/library/include/modules/Persistence.h +++ b/library/include/modules/Persistence.h @@ -214,6 +214,6 @@ namespace DFHack // equal to the given key. DFHACK_EXPORT void getAllByKey(std::vector &vec, int entity_id, const std::string &key); // Returns the tickcount of the most recent save. - DFHACK_EXPORT uint32_t getSaveDur(); + DFHACK_EXPORT uint32_t getUnsavedSeconds(); } } diff --git a/library/modules/Persistence.cpp b/library/modules/Persistence.cpp index 36a9770f55..a21feaeb28 100644 --- a/library/modules/Persistence.cpp +++ b/library/modules/Persistence.cpp @@ -49,7 +49,7 @@ using namespace DFHack; static std::unordered_map>> store; static std::unordered_map> entry_cache; -static uint32_t lastTickCount = 0; +static uint32_t lastLoadSaveTickCount = 0; size_t next_entry_id = 0; // goes more positive int next_fake_df_id = -101; // goes more negative @@ -200,7 +200,6 @@ void Persistence::Internal::save(color_ostream& out) { CoreSuspender suspend; // write status - lastTickCount = Core::getInstance().p->getTickCount(); { auto file = std::ofstream(getSaveFilePath("current", "status")); file << "DF version: " << core.p->getDescriptor()->getVersion() << std::endl; @@ -240,6 +239,7 @@ void Persistence::Internal::save(color_ostream& out) { color_ostream_wrapper wrapper(file); Lua::CallLuaModuleFunction(wrapper, "script-manager", "print_timers"); } + lastLoadSaveTickCount = Core::getInstance().p->getTickCount(); } static bool get_entity_id(const std::string & fname, int & entity_id) { @@ -309,8 +309,8 @@ void Persistence::Internal::load(color_ostream& out) { out.printerr("Cannot load data from: '%s'\n", path.c_str()); } + lastLoadSaveTickCount = Core::getInstance().p->getTickCount(); if (found) - lastTickCount = Core::getInstance().p->getTickCount(); return; // new file formats not found; attempt to load legacy file @@ -422,7 +422,7 @@ void Persistence::getAllByKey(std::vector &vec, int entity_i vec.emplace_back(it->second); } -uint32_t Persistence::getSaveDur() { - uint32_t durMS = Core::getInstance().p->getTickCount() - lastTickCount; - return durMS / (60 * 1000); +uint32_t Persistence::getUnsavedSeconds() { + uint32_t durMS = Core::getInstance().p->getTickCount() - lastLoadSaveTickCount; + return durMS / (1000); } From c50f5f5d7faa5d1a23ac6bbba52810c7de4480b5 Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:13:41 -0600 Subject: [PATCH 10/27] put things in the proper place per code review --- library/LuaApi.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 97a5b216bd..894ee4ea06 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -353,6 +353,11 @@ static int dfhack_persistent_delete_world_data(lua_State *L) { return delete_site_data(L, get_world_data); } +static int dfhack_persistent_get_last_save_time(lua_State *L) { + lua_pushinteger(L, Persistence::getUnsavedSeconds()); + return 1; +} + static const luaL_Reg dfhack_persistent_funcs[] = { { "getSiteDataString", dfhack_persistent_get_site_data_string }, { "saveSiteDataString", dfhack_persistent_save_site_data_string }, @@ -360,6 +365,7 @@ static const luaL_Reg dfhack_persistent_funcs[] = { { "getWorldDataString", dfhack_persistent_get_world_data_string }, { "saveWorldDataString", dfhack_persistent_save_world_data_string }, { "deleteWorldData", dfhack_persistent_delete_world_data }, + { "getUnsavedSecs", dfhack_persistent_get_last_save_time }, { NULL, NULL } }; @@ -1343,7 +1349,7 @@ static string getArchitectureName() static string getDFVersion() { return Core::getInstance().vinfo->getVersion(); } static uint32_t getTickCount() { return Core::getInstance().p->getTickCount(); } -static uint32_t getCurSaveDur() { return Persistence::getSaveDur(); } +static uint32_t getCurSaveDur() { return Persistence::getUnsavedSeconds(); } static string getDFPath() { return Core::getInstance().p->getPath(); } static string getHackPath() { return Core::getInstance().getHackPath(); } From 001a94856b3f67a6f00ff980229322a8e8e1296c Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:32:30 -0600 Subject: [PATCH 11/27] Add docs for new API function --- docs/dev/Lua API.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 3369705a78..f57409b39f 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -771,6 +771,10 @@ arbitrary Lua tables. Same semantics as for the ``Site`` functions, but will associated the data with the global world context. +* ``dfhack.persistent.getUnsavedSecs()`` + + Returns the number of seconds since last save or load of a save + The data is kept in memory, so no I/O occurs when getting or saving keys. It is all written to a json file in the game save directory when the game is saved. From 74c28450d3cdb06f6a4d26b02763f79d38f7075e Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:42:38 -0600 Subject: [PATCH 12/27] Apply suggestions from code review Co-authored-by: Myk --- library/LuaApi.cpp | 2 +- library/include/modules/Persistence.h | 2 +- library/modules/Persistence.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 894ee4ea06..1b357dcef3 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -365,7 +365,7 @@ static const luaL_Reg dfhack_persistent_funcs[] = { { "getWorldDataString", dfhack_persistent_get_world_data_string }, { "saveWorldDataString", dfhack_persistent_save_world_data_string }, { "deleteWorldData", dfhack_persistent_delete_world_data }, - { "getUnsavedSecs", dfhack_persistent_get_last_save_time }, + { "getUnsavedSeconds", dfhack_persistent_get_last_save_time }, { NULL, NULL } }; diff --git a/library/include/modules/Persistence.h b/library/include/modules/Persistence.h index 748994c4bb..49757e9baa 100644 --- a/library/include/modules/Persistence.h +++ b/library/include/modules/Persistence.h @@ -213,7 +213,7 @@ namespace DFHack // Fills the vector with references to each persistent item with a key that is // equal to the given key. DFHACK_EXPORT void getAllByKey(std::vector &vec, int entity_id, const std::string &key); - // Returns the tickcount of the most recent save. + // Returns the number of seconds since the current savegame was saved or loaded. DFHACK_EXPORT uint32_t getUnsavedSeconds(); } } diff --git a/library/modules/Persistence.cpp b/library/modules/Persistence.cpp index a21feaeb28..652c550d6a 100644 --- a/library/modules/Persistence.cpp +++ b/library/modules/Persistence.cpp @@ -239,6 +239,7 @@ void Persistence::Internal::save(color_ostream& out) { color_ostream_wrapper wrapper(file); Lua::CallLuaModuleFunction(wrapper, "script-manager", "print_timers"); } + lastLoadSaveTickCount = Core::getInstance().p->getTickCount(); } @@ -424,5 +425,5 @@ void Persistence::getAllByKey(std::vector &vec, int entity_i uint32_t Persistence::getUnsavedSeconds() { uint32_t durMS = Core::getInstance().p->getTickCount() - lastLoadSaveTickCount; - return durMS / (1000); + return durMS / 1000; } From 950d9513996a07bdb35c8ea933a7ea54c5ba03af Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:51:18 -0600 Subject: [PATCH 13/27] Apply suggestions from code review Co-authored-by: Myk --- docs/dev/Lua API.rst | 4 ++-- library/LuaApi.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index f57409b39f..bfadfc6899 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -771,9 +771,9 @@ arbitrary Lua tables. Same semantics as for the ``Site`` functions, but will associated the data with the global world context. -* ``dfhack.persistent.getUnsavedSecs()`` +* ``dfhack.persistent.getUnsavedSeconds()`` - Returns the number of seconds since last save or load of a save + Returns the number of seconds since last save or load of a save. The data is kept in memory, so no I/O occurs when getting or saving keys. It is all written to a json file in the game save directory when the game is saved. diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 1b357dcef3..edadc552e9 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -353,7 +353,7 @@ static int dfhack_persistent_delete_world_data(lua_State *L) { return delete_site_data(L, get_world_data); } -static int dfhack_persistent_get_last_save_time(lua_State *L) { +static int dfhack_persistent_get_unsaved_seconds(lua_State *L) { lua_pushinteger(L, Persistence::getUnsavedSeconds()); return 1; } @@ -365,7 +365,7 @@ static const luaL_Reg dfhack_persistent_funcs[] = { { "getWorldDataString", dfhack_persistent_get_world_data_string }, { "saveWorldDataString", dfhack_persistent_save_world_data_string }, { "deleteWorldData", dfhack_persistent_delete_world_data }, - { "getUnsavedSeconds", dfhack_persistent_get_last_save_time }, + { "getUnsavedSeconds", dfhack_persistent_get_unsaved_seconds }, { NULL, NULL } }; From 770f0ba0d0a71133318a66219b86f706996ce00d Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:53:02 -0600 Subject: [PATCH 14/27] Remove old code --- library/LuaApi.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index edadc552e9..b92e0eddbb 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1349,7 +1349,6 @@ static string getArchitectureName() static string getDFVersion() { return Core::getInstance().vinfo->getVersion(); } static uint32_t getTickCount() { return Core::getInstance().p->getTickCount(); } -static uint32_t getCurSaveDur() { return Persistence::getUnsavedSeconds(); } static string getDFPath() { return Core::getInstance().p->getPath(); } static string getHackPath() { return Core::getInstance().getHackPath(); } @@ -1377,7 +1376,6 @@ static const LuaWrapper::FunctionReg dfhack_module[] = { WRAP(getDFVersion), WRAP(getDFPath), WRAP(getTickCount), - WRAP(getCurSaveDur), WRAP(getHackPath), WRAP(isWorldLoaded), WRAP(isMapLoaded), From 0070b57b647a7a040674458b5b8d6e0d95c62dfa Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:12:25 -0600 Subject: [PATCH 15/27] Use a wrapper for detecting save/load --- library/modules/Persistence.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/library/modules/Persistence.cpp b/library/modules/Persistence.cpp index 652c550d6a..0a6f1c3772 100644 --- a/library/modules/Persistence.cpp +++ b/library/modules/Persistence.cpp @@ -191,6 +191,12 @@ static std::string getSaveFilePath(const std::string &world, const std::string & return getSavePath(world) + "/dfhack-" + filterSaveFileName(name) + ".dat"; } +struct LastLoadSaveTickCountUpdater { + ~LastLoadSaveTickCountUpdater() { + lastLoadSaveTickCount = Core::getInstance().p->getTickCount(); + } +}; + void Persistence::Internal::save(color_ostream& out) { Core &core = Core::getInstance(); @@ -198,6 +204,7 @@ void Persistence::Internal::save(color_ostream& out) { return; CoreSuspender suspend; + LastLoadSaveTickCountUpdater tickCountUpdater; // write status { @@ -240,7 +247,6 @@ void Persistence::Internal::save(color_ostream& out) { Lua::CallLuaModuleFunction(wrapper, "script-manager", "print_timers"); } - lastLoadSaveTickCount = Core::getInstance().p->getTickCount(); } static bool get_entity_id(const std::string & fname, int & entity_id) { @@ -287,6 +293,7 @@ static bool load_file(const std::string & path, int entity_id) { void Persistence::Internal::load(color_ostream& out) { CoreSuspender suspend; + LastLoadSaveTickCountUpdater tickCountUpdater; clear(out); @@ -310,7 +317,6 @@ void Persistence::Internal::load(color_ostream& out) { out.printerr("Cannot load data from: '%s'\n", path.c_str()); } - lastLoadSaveTickCount = Core::getInstance().p->getTickCount(); if (found) return; From a33aa17a6223a3ab35e5a1630b9e21fedc91a7ba Mon Sep 17 00:00:00 2001 From: Squid Coder <92821989+realSquidCoder@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:20:43 -0600 Subject: [PATCH 16/27] Update changelog.txt --- docs/changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index a89869972b..eaee5ed00a 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -77,11 +77,13 @@ Template for new versions: - ``Units::isUnitInBox``, ``Units::getUnitsInBox``: add versions accepting pos arguments - ``Units::getVisibleName``: when acting on a unit without an impersonated identity, returns the unit's name structure instead of the associated histfig's name structure - ``Translation::generateName``: generates in-game names, mirroring DF's internal logic +- ``Persistence::getUnsavedSeconds``: returns the number of seconds since last save or last load ## Lua - ``dfhack.units.isUnitInBox``, ``dfhack.units.getUnitsInBox``: add versions accepting pos arguments - ``widgets.FilteredList``: search keys for list items can now be functions that return a string - ``dfhack.translation.generateName``: Lua API for ``Translation::generateName`` +- ``dfhack.persistent.getUnsavedSeconds``: Lua API for ``Persistence::getUnsavedSeconds`` ## Removed - ``dfhack.TranslateName`` has been renamed to ``dfhack.translation.translateName`` From 14678f5f57f0dc4884e88b938bd5dda87351cf14 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 16 Jan 2025 03:52:15 +0000 Subject: [PATCH 17/27] Auto-update submodules plugins/stonesense: master --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index 6ff89be8cd..500babd8e6 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 6ff89be8cd79787ac32ebafc071a6cdeadad878a +Subproject commit 500babd8e69e4051df04b53abba61abb9762974f From a27572c6682c250f9b3486fbb9b49127cded1b1a Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 16 Jan 2025 04:03:56 +0000 Subject: [PATCH 18/27] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index a8e61195dc..a28dd7ce78 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit a8e61195dc42162aff48eb7e7a14118c41ab4dcd +Subproject commit a28dd7ce78182e305941865f90758392b32a25d4 From 66e98d6c9d604b4d43a84c3bfaf7dae85b1dfcf3 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Wed, 15 Jan 2025 20:10:37 -0800 Subject: [PATCH 19/27] changelog editing pass --- docs/changelog.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index eaee5ed00a..2e1973a02c 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -55,7 +55,7 @@ Template for new versions: ## New Features - `stockpiles`: add simple import/export dialogs to stockpile overlay panel -- `orders`: add overlays to the manager orders screen that allow right clicks to cancel edit of quantities or condition details instead of exiting to the main screen +- `orders`: add transparent overlays to the manager orders screen that allow right clicks to cancel edit of quantities or condition details instead of exiting to the main screen ## Fixes - `preserve-rooms`: don't erroneously release reservations for units that have returned from their missions but have not yet entered the fort map @@ -67,7 +67,7 @@ Template for new versions: ## Misc Improvements - `strangemood`: add ability to choose Stone Cutting and Stone Carving as the mood skill -- `suspendmanager`: add more specific messages for submerged jobsites and those managed by `buildingplan` +- `suspendmanager`: add more specific messages for submerged job sites and those managed by `buildingplan` - `dig-now`: handle digging in pool and river tiles ## Documentation @@ -77,7 +77,7 @@ Template for new versions: - ``Units::isUnitInBox``, ``Units::getUnitsInBox``: add versions accepting pos arguments - ``Units::getVisibleName``: when acting on a unit without an impersonated identity, returns the unit's name structure instead of the associated histfig's name structure - ``Translation::generateName``: generates in-game names, mirroring DF's internal logic -- ``Persistence::getUnsavedSeconds``: returns the number of seconds since last save or last load +- ``Persistence::getUnsavedSeconds``: returns the number of seconds since last save or load ## Lua - ``dfhack.units.isUnitInBox``, ``dfhack.units.getUnitsInBox``: add versions accepting pos arguments @@ -87,7 +87,6 @@ Template for new versions: ## Removed - ``dfhack.TranslateName`` has been renamed to ``dfhack.translation.translateName`` -- ``Translation::TranslateName`` has been renamed to ``Translation::translateName`` ## Internals - Plugin command callbacks are now called with the core suspended by default so DF memory is always safe to access without extra steps From 0e9b8ca612a7f01ceb5316cbba04a44dd9c7a460 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Wed, 15 Jan 2025 20:10:47 -0800 Subject: [PATCH 20/27] update scripts ref --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index a28dd7ce78..6b9daef9ec 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit a28dd7ce78182e305941865f90758392b32a25d4 +Subproject commit 6b9daef9ec08ba2fca0d636a90ea9fb9734ac022 From 82ddfcd83e2b29e227d43ce8aa648a18ebfdcb93 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 16 Jan 2025 07:16:35 +0000 Subject: [PATCH 21/27] Auto-update submodules plugins/stonesense: master --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index 500babd8e6..3cd2e0d75b 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 500babd8e69e4051df04b53abba61abb9762974f +Subproject commit 3cd2e0d75b35ab3d63005846b79a502a078d0aa9 From f517c4beba0236710ba6db4977bb211be4040d18 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:46:11 +0000 Subject: [PATCH 22/27] Auto-update submodules plugins/stonesense: master --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index 3cd2e0d75b..5838a5efce 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 3cd2e0d75b35ab3d63005846b79a502a078d0aa9 +Subproject commit 5838a5efce459d917ea58732c271c47c22cf6e2a From dd64ba0e49bb3168514c1aac451e45d8ae0f822c Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Fri, 17 Jan 2025 02:47:09 +0000 Subject: [PATCH 23/27] Auto-update submodules plugins/stonesense: master --- plugins/stonesense | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stonesense b/plugins/stonesense index 5838a5efce..49053b268d 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 5838a5efce459d917ea58732c271c47c22cf6e2a +Subproject commit 49053b268d74dea6a5a1c6e3a7a0c05a7496fb85 From 7a072ce0fbf20c5e0be294f3e10d593100d5fc25 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Fri, 17 Jan 2025 03:58:26 +0000 Subject: [PATCH 24/27] Auto-update submodules scripts: master plugins/stonesense: master --- plugins/stonesense | 2 +- scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/stonesense b/plugins/stonesense index 49053b268d..e90d8ec340 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit 49053b268d74dea6a5a1c6e3a7a0c05a7496fb85 +Subproject commit e90d8ec3405cb8f3a6990b0efd9e13614975e7f8 diff --git a/scripts b/scripts index 6b9daef9ec..99d714e135 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 6b9daef9ec08ba2fca0d636a90ea9fb9734ac022 +Subproject commit 99d714e135758bda076dca871c6b3d85229b6e33 From 115afa2cc168be50dcc1e744cc03d49a7887df37 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Fri, 17 Jan 2025 07:16:30 +0000 Subject: [PATCH 25/27] Auto-update submodules library/xml: master --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 86892b1d66..8344013c02 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 86892b1d66cf8e615f73257f77c5d98ee16100f5 +Subproject commit 8344013c02e119297bad688057d882a0fc34cd14 From a6bdb7988164ccdc32b50dc9d90d921d95fb729e Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 17 Jan 2025 08:25:38 -0800 Subject: [PATCH 26/27] bump to 50.15-r2 --- CMakeLists.txt | 2 +- docs/changelog.txt | 16 ++++++++++++++++ library/xml | 2 +- plugins/stonesense | 2 +- scripts | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9f526f0e2..31f068c900 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_policy(SET CMP0074 NEW) # set up versioning. set(DF_VERSION "50.15") -set(DFHACK_RELEASE "r1.2") +set(DFHACK_RELEASE "r2") set(DFHACK_PRERELEASE FALSE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") diff --git a/docs/changelog.txt b/docs/changelog.txt index 2e1973a02c..b12dbc724d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -53,6 +53,22 @@ Template for new versions: ## New Tools +## New Features + +## Fixes + +## Misc Improvements + +## Documentation + +## API + +## Lua + +## Removed + +# 50.15-r2 + ## New Features - `stockpiles`: add simple import/export dialogs to stockpile overlay panel - `orders`: add transparent overlays to the manager orders screen that allow right clicks to cancel edit of quantities or condition details instead of exiting to the main screen diff --git a/library/xml b/library/xml index 8344013c02..c6c8f15afe 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 8344013c02e119297bad688057d882a0fc34cd14 +Subproject commit c6c8f15afec05d457813c003a869509901993af4 diff --git a/plugins/stonesense b/plugins/stonesense index e90d8ec340..e1e5b95675 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit e90d8ec3405cb8f3a6990b0efd9e13614975e7f8 +Subproject commit e1e5b95675f8ed3b9462db5a8be882c07acec748 diff --git a/scripts b/scripts index 99d714e135..fbcb217a53 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 99d714e135758bda076dca871c6b3d85229b6e33 +Subproject commit fbcb217a533a7fb08532f6f000a5acb719feee5f From 6870494ea42090c52c37f187fe282d8950ecbda1 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:25:09 +0000 Subject: [PATCH 27/27] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index fbcb217a53..38b3b0f4a3 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit fbcb217a533a7fb08532f6f000a5acb719feee5f +Subproject commit 38b3b0f4a3f0f9bd66837ab65b7010736baf587e