Store time display settings both in savegame and client, add setting

This commit is contained in:
Jonathan G Rennison
2020-06-23 21:05:21 +01:00
parent 22b13ffc26
commit f5e9805b10
17 changed files with 180 additions and 72 deletions

View File

@@ -86,6 +86,7 @@
ClientSettings _settings_client;
GameSettings _settings_game; ///< Game settings of a running game or the scenario editor.
GameSettings _settings_newgame; ///< Game settings for new games (updated from the intro screen).
TimeSettings _settings_time; ///< The effective settings that are used for time display.
VehicleDefaultSettings _old_vds; ///< Used for loading default vehicles settings from old savegames
char *_config_file; ///< Configuration file of OpenTTD
std::string _config_file_text;
@@ -1164,6 +1165,21 @@ static bool InvalidateVehTimetableWindow(int32 p1)
return true;
}
static bool UpdateTimeSettings(int32 p1)
{
SetupTimeSettings();
InvalidateVehTimetableWindow(p1);
MarkWholeScreenDirty();
return true;
}
static bool ChangeTimeOverrideMode(int32 p1)
{
InvalidateWindowClassesData(WC_GAME_OPTIONS);
UpdateTimeSettings(p1);
return true;
}
static bool ZoomMinMaxChanged(int32 p1)
{
extern void ConstrainAllViewportsZoom();
@@ -2882,3 +2898,8 @@ static bool IsSignedVarMemType(VarType vt)
}
return false;
}
void SetupTimeSettings()
{
_settings_time = (_game_mode == GM_MENU || _settings_client.gui.override_time_settings) ? _settings_client.gui : _settings_game.game_time;
}