Add setting to control autosave interval mode
This commit is contained in:
@@ -437,6 +437,9 @@ STR_CONFIG_SETTING_VIEWPORT_MAP_DRAW_ROUTE_DASH_HELPTEXT :How to draw the
|
|||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_DRAW_ROUTE_DASH_VALUE :dashed lines of {COMMA} pixel{P "" s}
|
STR_CONFIG_SETTING_VIEWPORT_MAP_DRAW_ROUTE_DASH_VALUE :dashed lines of {COMMA} pixel{P "" s}
|
||||||
STR_CONFIG_SETTING_VIEWPORT_MAP_DRAW_ROUTE_DASH_DISABLED :plain lines
|
STR_CONFIG_SETTING_VIEWPORT_MAP_DRAW_ROUTE_DASH_DISABLED :plain lines
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_AUTOSAVE_REALTIME :Autosave interval uses real-time: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_AUTOSAVE_REALTIME_HELPTEXT :When enabled, autosave intervals uses real elapsed wall-clock time, (when paused autosaving will stop until you make any change to the game).{}When disabled, autosave intervals use elapsed game simulation time.
|
||||||
|
|
||||||
STR_CONFIG_SETTING_AUTOSAVE_ON_NETWORK_DISCONNECT :Autosave on network disconnection: {STRING2}
|
STR_CONFIG_SETTING_AUTOSAVE_ON_NETWORK_DISCONNECT :Autosave on network disconnection: {STRING2}
|
||||||
STR_CONFIG_SETTING_AUTOSAVE_ON_NETWORK_DISCONNECT_HELPTEXT :When enabled, multiplayer clients automatically save the game when disconnected from the server
|
STR_CONFIG_SETTING_AUTOSAVE_ON_NETWORK_DISCONNECT_HELPTEXT :When enabled, multiplayer clients automatically save the game when disconnected from the server
|
||||||
|
|
||||||
|
@@ -2106,7 +2106,7 @@ void StateGameLoop()
|
|||||||
_scaled_date_ticks++; // This must update in lock-step with _tick_skip_counter, such that it always matches what SetScaledTickVariables would return.
|
_scaled_date_ticks++; // This must update in lock-step with _tick_skip_counter, such that it always matches what SetScaledTickVariables would return.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(_game_mode == GM_MENU || _game_mode == GM_BOOTSTRAP) &&
|
if (!(_game_mode == GM_MENU || _game_mode == GM_BOOTSTRAP) && !_settings_client.gui.autosave_realtime &&
|
||||||
(_scaled_date_ticks % (_settings_client.gui.autosave_interval * (_settings_game.economy.tick_rate == TRM_MODERN ? (60000 / 27) : (60000 / 30)))) == 0) {
|
(_scaled_date_ticks % (_settings_client.gui.autosave_interval * (_settings_game.economy.tick_rate == TRM_MODERN ? (60000 / 27) : (60000 / 30)))) == 0) {
|
||||||
_do_autosave = true;
|
_do_autosave = true;
|
||||||
_check_special_modes = true;
|
_check_special_modes = true;
|
||||||
@@ -2228,7 +2228,8 @@ static IntervalTimer<TimerGameRealtime> _autosave_interval({std::chrono::millise
|
|||||||
*/
|
*/
|
||||||
void ChangeAutosaveFrequency(bool reset)
|
void ChangeAutosaveFrequency(bool reset)
|
||||||
{
|
{
|
||||||
_autosave_interval.SetInterval({_settings_client.gui.autosave_realtime, TimerGameRealtime::AUTOSAVE}, reset);
|
std::chrono::minutes interval = _settings_client.gui.autosave_realtime ? std::chrono::minutes(_settings_client.gui.autosave_interval) : std::chrono::minutes::zero();
|
||||||
|
_autosave_interval.SetInterval({interval, TimerGameRealtime::AUTOSAVE}, reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2001,6 +2001,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
SettingsPage *save = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_SAVE));
|
SettingsPage *save = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_SAVE));
|
||||||
{
|
{
|
||||||
save->Add(new SettingEntry("gui.autosave_interval"));
|
save->Add(new SettingEntry("gui.autosave_interval"));
|
||||||
|
save->Add(new SettingEntry("gui.autosave_realtime"));
|
||||||
save->Add(new SettingEntry("gui.autosave_on_network_disconnect"));
|
save->Add(new SettingEntry("gui.autosave_on_network_disconnect"));
|
||||||
save->Add(new SettingEntry("gui.savegame_overwrite_confirm"));
|
save->Add(new SettingEntry("gui.savegame_overwrite_confirm"));
|
||||||
}
|
}
|
||||||
|
@@ -177,6 +177,7 @@ struct GUISettings : public TimeSettings {
|
|||||||
ZoomLevel zoom_max; ///< maximum zoom out level
|
ZoomLevel zoom_max; ///< maximum zoom out level
|
||||||
ZoomLevel sprite_zoom_min; ///< maximum zoom level at which higher-resolution alternative sprites will be used (if available) instead of scaling a lower resolution sprite
|
ZoomLevel sprite_zoom_min; ///< maximum zoom level at which higher-resolution alternative sprites will be used (if available) instead of scaling a lower resolution sprite
|
||||||
uint32 autosave_interval; ///< how often should we do autosaves?
|
uint32 autosave_interval; ///< how often should we do autosaves?
|
||||||
|
bool autosave_realtime; ///< autosaves based on real elapsed time (with pause handling)
|
||||||
bool threaded_saves; ///< should we do threaded saves?
|
bool threaded_saves; ///< should we do threaded saves?
|
||||||
bool keep_all_autosave; ///< name the autosave in a different way
|
bool keep_all_autosave; ///< name the autosave in a different way
|
||||||
bool autosave_on_exit; ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?"
|
bool autosave_on_exit; ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?"
|
||||||
|
@@ -4525,6 +4525,16 @@ strval = STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_MINUTES_CUSTOM
|
|||||||
post_cb = AutosaveModeChanged
|
post_cb = AutosaveModeChanged
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
|
[SDTC_BOOL]
|
||||||
|
var = gui.autosave_realtime
|
||||||
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
||||||
|
def = true
|
||||||
|
str = STR_CONFIG_SETTING_AUTOSAVE_REALTIME
|
||||||
|
strhelp = STR_CONFIG_SETTING_AUTOSAVE_REALTIME_HELPTEXT
|
||||||
|
post_cb = AutosaveModeChanged
|
||||||
|
patchcat = SC_PATCH
|
||||||
|
cat = SC_EXPERT
|
||||||
|
|
||||||
[SDTC_BOOL]
|
[SDTC_BOOL]
|
||||||
var = gui.threaded_saves
|
var = gui.threaded_saves
|
||||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
||||||
|
Reference in New Issue
Block a user