Skip to content

Commit a70ca31

Browse files
authored
Merge pull request #4916 from myk002/myk_save_on_retire
[Core] also save state on retire
2 parents 63b67a2 + 6df1550 commit a70ca31

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Template for new versions:
6969
- `regrass`: ``--mud`` now converts muddy slade to grass, consistent with normal DF behavior
7070
- `gui/pathable`: fix hang when showing trade depot wagon access and a trade depot is submerged under water
7171
- `gui/pathable`: fix incorrect calculation of wagon paths over stairs and through doors
72+
- Ensure DFHack state for the site is properly saved when retiring a fort
7273

7374
## Misc Improvements
7475
- `sort`: can now search for stockpiles on the Places>Stockpile tab by name, number, or enabled item categories

library/Core.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ distribution.
5757
#include "df/interfacest.h"
5858
#include "df/plotinfost.h"
5959
#include "df/viewscreen_dwarfmodest.h"
60+
#include "df/viewscreen_export_regionst.h"
6061
#include "df/viewscreen_game_cleanerst.h"
6162
#include "df/viewscreen_loadgamest.h"
6263
#include "df/viewscreen_new_regionst.h"
@@ -1948,15 +1949,16 @@ void Core::doUpdate(color_ostream &out)
19481949
vs_changed = true;
19491950
}
19501951

1951-
bool is_load_save =
1952+
bool is_save = strict_virtual_cast<df::viewscreen_savegamest>(screen) ||
1953+
strict_virtual_cast<df::viewscreen_export_regionst>(screen);
1954+
bool is_load_save = is_save ||
19521955
strict_virtual_cast<df::viewscreen_game_cleanerst>(screen) ||
1953-
strict_virtual_cast<df::viewscreen_loadgamest>(screen) ||
1954-
strict_virtual_cast<df::viewscreen_savegamest>(screen);
1956+
strict_virtual_cast<df::viewscreen_loadgamest>(screen);
19551957

19561958
// save data (do this before updating last_world_data_ptr and triggering unload events)
19571959
if ((df::global::game && df::global::game->main_interface.options.do_manual_save && !d->last_manual_save_request) ||
19581960
(df::global::plotinfo && df::global::plotinfo->main.autosave_request && !d->last_autosave_request) ||
1959-
(is_load_save && !d->was_load_save && strict_virtual_cast<df::viewscreen_savegamest>(screen)))
1961+
(is_load_save && !d->was_load_save && is_save))
19601962
{
19611963
plug_mgr->doSaveData(out);
19621964
Persistence::Internal::save(out);

0 commit comments

Comments
 (0)