Change: base autosaves intervals on real time (instead of game time) (#10655)

There are two fundamental issues with autosave:
- When fast-forwarding, it saves way too often
- When paused, it never saves

Both makes no sense. Autosaves are meant to prevent you from
accidentally losing your work. The emphasis on "your" work.

To solve both issues, the autosave now works on real time. You
can select every 10 / 30 / 60 / 120 minutes, which are similar to
what the setting was in game-months.

When you pause, autosaving will stop. Unless you make any change
to the game; then it will continue to make autosaves, even so
the game is paused. Unpausing / pausing resets this mechanism.
This commit is contained in:
Patric Stout
2023-04-27 17:21:29 +02:00
committed by GitHub
parent 57f2d70fef
commit f5fad88723
10 changed files with 187 additions and 28 deletions

View File

@@ -51,10 +51,10 @@
static const StringID _autosave_dropdown[] = {
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_3_MONTHS,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_6_MONTHS,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_12_MONTHS,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_10_MINUTES,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_30_MINUTES,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_60_MINUTES,
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_120_MINUTES,
INVALID_STRING_ID,
};
@@ -595,6 +595,7 @@ struct GameOptionsWindow : Window {
case WID_GO_AUTOSAVE_DROPDOWN: // Autosave options
_settings_client.gui.autosave = index;
ChangeAutosaveFrequency(false);
this->SetDirty();
break;