From 327ff898080d94ab129f6e7ae3c268dcf10d6a08 Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Mon, 22 Apr 2019 13:14:46 +0100 Subject: [PATCH] Codechange: Remove PauseModeByte --- src/gfx.cpp | 2 +- src/misc_cmd.cpp | 4 ++-- src/openttd.h | 5 ++--- src/saveload/oldloader.cpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gfx.cpp b/src/gfx.cpp index 5165fe01c4..4fd705b9f1 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -46,7 +46,7 @@ bool _screen_disable_anim = false; ///< Disable palette animation (important f bool _exit_game; GameMode _game_mode; SwitchMode _switch_mode; ///< The next mainloop command. -PauseModeByte _pause_mode; +PauseMode _pause_mode; Palette _cur_palette; static byte _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth() diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index f0ccfbd744..4271f57581 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -173,9 +173,9 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, PauseMode prev_mode = _pause_mode; if (p2 == 0) { - _pause_mode = _pause_mode & ~p1; + _pause_mode = static_cast(_pause_mode & (byte)~p1); } else { - _pause_mode = _pause_mode | p1; + _pause_mode = static_cast(_pause_mode | (byte)p1); } NetworkHandlePauseChange(prev_mode, (PauseMode)p1); diff --git a/src/openttd.h b/src/openttd.h index 5e360d6fcd..539b7e14f1 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -54,7 +54,7 @@ extern SwitchMode _switch_mode; extern bool _exit_game; /** Modes of pausing we've got */ -enum PauseMode { +enum PauseMode : byte { PM_UNPAUSED = 0, ///< A normal unpaused game PM_PAUSED_NORMAL = 1 << 0, ///< A game normally paused PM_PAUSED_SAVELOAD = 1 << 1, ///< A game paused for saving/loading @@ -67,10 +67,9 @@ enum PauseMode { PMB_PAUSED_NETWORK = PM_PAUSED_ACTIVE_CLIENTS | PM_PAUSED_JOIN, }; DECLARE_ENUM_AS_BIT_SET(PauseMode) -typedef SimpleTinyEnumT PauseModeByte; /** The current pause mode */ -extern PauseModeByte _pause_mode; +extern PauseMode _pause_mode; void AskExitGame(); void AskExitToGameMenu(); diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index 9b24750d29..11eb058fad 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -314,7 +314,7 @@ bool LoadOldSaveGame(const char *file) return false; } - _pause_mode = 2; + _pause_mode = PM_PAUSED_SAVELOAD; return true; }