From d288642b3ca7006b7f5bfa299df5b5720082278b Mon Sep 17 00:00:00 2001 From: Nicholas McDaniel Date: Thu, 5 Dec 2024 15:48:23 -0500 Subject: [PATCH 1/3] Reset racefilter on world and map load Prevents usage of stale state when loading multiple worlds or timelines in a single session. --- exportlegends.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exportlegends.lua b/exportlegends.lua index 80a4ec299..305c28545 100644 --- a/exportlegends.lua +++ b/exportlegends.lua @@ -1038,6 +1038,11 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc) if sc == SC_VIEWSCREEN_CHANGED and df.viewscreen_choose_game_typest:is_instance(dfhack.gui.getDFViewscreen(true)) then asyncexport.reset_state() end + + -- Reset state when a world or map is loaded to ensure data remains current + if sc == SC_WORLD_LOADED or sc == SC_MAP_LOADED then + racefilter.reset_state() + end end if dfhack_flags.module then From e8bb513f12baa6dde8c7efd40ae770fc85380b8e Mon Sep 17 00:00:00 2001 From: Nicholas McDaniel Date: Thu, 5 Dec 2024 20:46:11 -0500 Subject: [PATCH 2/3] Add entry to changelog --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index fd18b433e..6bb14ce5d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -45,6 +45,7 @@ Template for new versions: - `geld`, `ungeld`: save-and-reload no longer loses changes done by `geld` and `ungeld` for units who are historical figures - `rejuvenate`: fix error when specifying ``--age`` parameter - `gui/notify`: don't classify (peacefully) visiting night creatures as hostile +- `exportlegends`: fix race filter not refreshing on world load, leading to incorrect results ## Misc Improvements - `idle-crafting`: also support making shell crafts for workshops with linked input stockpiles From b6372bf1c7660a859ec1dd58bd20b83d4329a277 Mon Sep 17 00:00:00 2001 From: Nicholas McDaniel Date: Thu, 5 Dec 2024 23:01:45 -0500 Subject: [PATCH 3/3] Only reset state on world load --- exportlegends.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exportlegends.lua b/exportlegends.lua index 305c28545..db5e12ffb 100644 --- a/exportlegends.lua +++ b/exportlegends.lua @@ -1040,7 +1040,7 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc) end -- Reset state when a world or map is loaded to ensure data remains current - if sc == SC_WORLD_LOADED or sc == SC_MAP_LOADED then + if sc == SC_WORLD_LOADED then racefilter.reset_state() end end