Codechange: Use EnumBitSet for PauseMode. (#13553)

This commit is contained in:
Peter Nelson
2025-02-14 08:30:04 +00:00
committed by GitHub
parent 3518d7e0f1
commit 6cf7a899e9
27 changed files with 113 additions and 118 deletions
+4 -4
View File
@@ -584,8 +584,8 @@ bool AfterLoadGame()
if (IsSavegameVersionBefore(SLV_98)) _gamelog.GRFAddList(_grfconfig);
if (IsSavegameVersionBefore(SLV_119)) {
_pause_mode = (_pause_mode == 2) ? PM_PAUSED_NORMAL : PM_UNPAUSED;
} else if (_network_dedicated && (_pause_mode & PM_PAUSED_ERROR) != 0) {
_pause_mode = (_pause_mode.base() == 2) ? PauseMode::Normal : PauseModes{};
} else if (_network_dedicated && _pause_mode.Test(PauseMode::Error)) {
Debug(net, 0, "The loading savegame was paused due to an error state");
Debug(net, 0, " This savegame cannot be used for multiplayer");
/* Restore the signals */
@@ -599,7 +599,7 @@ bool AfterLoadGame()
* active clients. Note that resetting these values for a network
* client are very bad because then the client is going to execute
* the game loop when the server is not, i.e. it desyncs. */
_pause_mode &= ~PMB_PAUSED_NETWORK;
_pause_mode.Reset({PauseMode::ActiveClients, PauseMode::Join});
}
/* In very old versions, size of train stations was stored differently.
@@ -723,7 +723,7 @@ bool AfterLoadGame()
switch (gcf_res) {
case GLC_COMPATIBLE: ShowErrorMessage(STR_NEWGRF_COMPATIBLE_LOAD_WARNING, INVALID_STRING_ID, WL_CRITICAL); break;
case GLC_NOT_FOUND: ShowErrorMessage(STR_NEWGRF_DISABLED_WARNING, INVALID_STRING_ID, WL_CRITICAL); _pause_mode = PM_PAUSED_ERROR; break;
case GLC_NOT_FOUND: ShowErrorMessage(STR_NEWGRF_DISABLED_WARNING, INVALID_STRING_ID, WL_CRITICAL); _pause_mode = PauseMode::Error; break;
default: break;
}