From 2e93daf93bcbf05a2d81f0bab6b58e55b35e8d37 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 27 Jan 2024 16:48:00 +0000 Subject: [PATCH] Advance _scaled_date_ticks in scenario editor For timetables and train speed adaptation --- src/openttd.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openttd.cpp b/src/openttd.cpp index 63456b58f7..df07cd5479 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2113,6 +2113,15 @@ void StateGameLoop() if (_game_mode == GM_EDITOR) { BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP); + + /* _scaled_date_ticks and _scaled_date_ticks_offset must update in lockstep here, + * as _date, _tick_skip_counter, etc are not updated in the scenario editor, + * but _scaled_date_ticks should still update in case there are vehicles running, + * to avoid problems with timetables and train speed adaptation + */ + _scaled_date_ticks++; + _scaled_date_ticks_offset++; + RunTileLoop(); CallVehicleTicks(); CallLandscapeTick();