Merge pull request #2860 from robob27/detect-manual-save

Detect manual save when persisting data
develop
Myk 2023-02-10 08:31:26 -08:00 committed by GitHub
commit 1c8b662b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

@ -42,6 +42,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `channel-safely`: fixed bug resulting in marker mode never being set for any designation
-@ `automelt`: fixed bug related to lua stack smashing behavior in returned stockpile configs
-@ `autochop`: fixed bug related to lua stack smashing behavior in returned stockpile configs
- `nestboxes`: now cancels any in-progress hauling jobs when it protects a fertile egg
-@ Fix persisted data not being written on manual save
- `nestboxes`: now scans for eggs more frequently and cancels any in-progress hauling jobs when it protects a fertile egg
## Misc Improvements

@ -146,6 +146,7 @@ struct Core::Private
std::thread hotkeythread;
bool last_autosave_request{false};
bool last_manual_save_request{false};
bool was_load_save{false};
};
@ -1847,7 +1848,8 @@ void Core::doUpdate(color_ostream &out)
strict_virtual_cast<df::viewscreen_savegamest>(screen);
// save data (do this before updating last_world_data_ptr and triggering unload events)
if ((df::global::plotinfo->main.autosave_request && !d->last_autosave_request) ||
if ((df::global::game->main_interface.options.do_manual_save && !d->last_manual_save_request) ||
(df::global::plotinfo->main.autosave_request && !d->last_autosave_request) ||
(is_load_save && !d->was_load_save && strict_virtual_cast<df::viewscreen_savegamest>(screen)))
{
doSaveData(out);
@ -1910,6 +1912,7 @@ void Core::doUpdate(color_ostream &out)
onUpdate(out);
d->last_autosave_request = df::global::plotinfo->main.autosave_request;
d->last_manual_save_request = df::global::game->main_interface.options.do_manual_save;
d->was_load_save = is_load_save;
out << std::flush;