From ca631b79c281b62549ab7d17850c7d040b797f80 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 5 Jul 2023 23:55:10 +0100 Subject: [PATCH] Fix crash which could occur when reloading NewGRFs on main menu --- src/openttd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openttd.cpp b/src/openttd.cpp index 0ac04903f7..613d7cc9b7 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2061,7 +2061,9 @@ void StateGameLoop() BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP); _tick_skip_counter++; _scaled_tick_counter++; - _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) { + _scaled_date_ticks++; // This must update in lock-step with _tick_skip_counter, such that it always matches what SetScaledTickVariables would return. + } if (_settings_client.gui.autosave == 6 && !(_game_mode == GM_MENU || _game_mode == GM_BOOTSTRAP) && (_scaled_date_ticks % (_settings_client.gui.autosave_custom_minutes * (_settings_game.economy.tick_rate == TRM_MODERN ? (60000 / 27) : (60000 / 30)))) == 0) {