From f2b6576d8f7644a94a32256459fad8e0eba6b248 Mon Sep 17 00:00:00 2001 From: dP Date: Fri, 5 Jun 2020 18:34:58 +0300 Subject: [PATCH] Add setting to pause game after load --- cm_changelog.txt | 3 +++ src/lang/english.txt | 2 ++ src/saveload/afterload.cpp | 3 +++ src/settings_gui.cpp | 1 + src/settings_type.h | 1 + src/table/settings.ini | 8 ++++++++ 6 files changed, 18 insertions(+) diff --git a/cm_changelog.txt b/cm_changelog.txt index 5128c474bf..d9683fa70c 100644 --- a/cm_changelog.txt +++ b/cm_changelog.txt @@ -74,6 +74,9 @@ This is usable for any OpenTTD servers == CHANGELOG == +*** next () *** +- Add a setting to pause games after loading + *** 1.10.2 (5 Jun 2020) *** - Add new minimap mode showing industries, height and farms at the same time. - Rename "CB town border" zone to "CB cargo acceptance", switch it to a new colored highlight and fix for new CB mode. diff --git a/src/lang/english.txt b/src/lang/english.txt index 8cf7cb6bf4..7cbdccac44 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5517,3 +5517,5 @@ STR_CM_CONFIG_SETTING_OPEN_ORDERS_FOR_NEW_VEHICLES :Open orders window for new v STR_CM_CONFIG_SETTING_OPEN_ORDERS_FOR_NEW_VEHICLES_HELPTEXT :Automatically open oreders windown along with a vehicle window for a new vehicles STR_CM_PURCHASE_ENGINE_ID :{BLACK}Engine ID: {GOLD}{NUM} STR_CM_SMALLMAP_TOOLTIP_SHOW_IMBA_ON_MAP :{BLACK}Show industries on map combined with land contours and vegetation +STR_CM_CONFIG_SETTING_PAUSE_AFTER_LOAD :Pause the game after loading: {STRING2} +STR_CM_CONFIG_SETTING_PAUSE_AFTER_LOAD_HELPTEXT :Control whether the game should be paused after load (if it's not already paused). Useful for desync debugging. diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index cb283847ee..d62be82186 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3205,6 +3205,9 @@ bool AfterLoadGame() AfterLoadLinkGraphs(); AfterLoadFindBTProCBInfo(); citymania::InitializeZoningMap(); + + if ((!_networking || _network_server ) && _settings_client.gui.pause_after_load) _pause_mode = PM_PAUSED_NORMAL; + return true; } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index c406fa3b35..15025585df 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1542,6 +1542,7 @@ static SettingsContainer &GetSettingsTree() general->Add(new SettingEntry("gui.window_snap_radius")); general->Add(new SettingEntry("gui.window_soft_limit")); general->Add(new SettingEntry("gui.right_mouse_wnd_close")); + general->Add(new SettingEntry("gui.pause_after_load")); } SettingsPage *viewports = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VIEWPORTS)); diff --git a/src/settings_type.h b/src/settings_type.h index d4c3347c49..eb655c255b 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -126,6 +126,7 @@ struct GUISettings { byte max_num_autosaves; ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1) bool population_in_label; ///< show the population of a town in his label? uint8 right_mouse_btn_emulation; ///< should we emulate right mouse clicking? + bool pause_after_load; ///< CM should we pause the game after loading save? uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel? uint8 scrollwheel_multiplier; ///< how much 'wheel' per incoming event from the OS? bool timetable_arrival_departure; ///< show arrivals and departures in vehicle timetables diff --git a/src/table/settings.ini b/src/table/settings.ini index f2430561bc..e6a3c4dffe 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -2672,6 +2672,14 @@ str = STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE strhelp = STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_HELPTEXT cat = SC_BASIC +[SDTC_BOOL] +var = gui.pause_after_load +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = false +str = STR_CM_CONFIG_SETTING_PAUSE_AFTER_LOAD +strhelp = STR_CM_CONFIG_SETTING_PAUSE_AFTER_LOAD_HELPTEXT +cat = SC_BASIC + [SDTC_BOOL] var = gui.measure_tooltip flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC