From 80fa53bc58d9a8f8201e023433f43ad33e76b8a9 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 3 Sep 2023 18:12:53 +0100 Subject: [PATCH] Allow unpausing upstream savegames using PM_COMMAND_DURING_PAUSE --- src/misc_cmd.cpp | 5 +++++ src/openttd.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index c24a78e60c..7038152db5 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -184,6 +184,11 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, if ((p2 & 1) == 0) { _pause_mode = static_cast(_pause_mode & (byte)~p1); _pause_countdown = (p2 >> 1); + + /* If the only remaining reason to be paused is that we saw a command during pause, unpause. */ + if (_pause_mode == PM_COMMAND_DURING_PAUSE) { + _pause_mode = PM_UNPAUSED; + } } else { _pause_mode = static_cast(_pause_mode | (byte)p1); } diff --git a/src/openttd.h b/src/openttd.h index 1148da8e36..8f3cd04634 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -75,6 +75,7 @@ enum PauseMode : byte { PM_PAUSED_ACTIVE_CLIENTS = 1 << 4, ///< A game paused for 'min_active_clients' PM_PAUSED_GAME_SCRIPT = 1 << 5, ///< A game paused by a game script PM_PAUSED_LINK_GRAPH = 1 << 6, ///< A game paused due to the link graph schedule lagging + PM_COMMAND_DURING_PAUSE = 1 << 7, ///< A game paused, and a command executed during the pause; resets on autosave /** Pause mode bits when paused for network reasons. */ PMB_PAUSED_NETWORK = PM_PAUSED_ACTIVE_CLIENTS | PM_PAUSED_JOIN,