Codechange: Use EnumBitSet for PauseMode. (#13553)
This commit is contained in:
@@ -57,8 +57,8 @@
|
||||
* needs manual action to continue. */
|
||||
ShowScriptDebugWindow(ScriptObject::GetRootCompany());
|
||||
|
||||
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
|
||||
ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_NORMAL, true);
|
||||
if (!_pause_mode.Test(PauseMode::Normal)) {
|
||||
ScriptObject::Command<CMD_PAUSE>::Do(PauseMode::Normal, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@
|
||||
|
||||
/* static */ bool ScriptGame::Pause()
|
||||
{
|
||||
return ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_GAME_SCRIPT, true);
|
||||
return ScriptObject::Command<CMD_PAUSE>::Do(PauseMode::GameScript, true);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptGame::Unpause()
|
||||
{
|
||||
return ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_GAME_SCRIPT, false);
|
||||
return ScriptObject::Command<CMD_PAUSE>::Do(PauseMode::GameScript, false);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptGame::IsPaused()
|
||||
{
|
||||
return !!_pause_mode;
|
||||
return _pause_mode.Any();
|
||||
}
|
||||
|
||||
/* static */ ScriptGame::LandscapeType ScriptGame::GetLandscape()
|
||||
|
||||
@@ -1081,7 +1081,7 @@ struct ScriptDebugWindow : public Window {
|
||||
}
|
||||
|
||||
/* If the last AI/Game Script is unpaused, unpause the game too. */
|
||||
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_PAUSED_NORMAL) {
|
||||
if (_pause_mode.Test(PauseMode::Normal)) {
|
||||
bool all_unpaused = !Game::IsPaused();
|
||||
if (all_unpaused) {
|
||||
for (const Company *c : Company::Iterate()) {
|
||||
@@ -1092,7 +1092,7 @@ struct ScriptDebugWindow : public Window {
|
||||
}
|
||||
if (all_unpaused) {
|
||||
/* All scripts have been unpaused => unpause the game. */
|
||||
Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false);
|
||||
Command<CMD_PAUSE>::Post(PauseMode::Normal, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1144,8 @@ struct ScriptDebugWindow : public Window {
|
||||
}
|
||||
|
||||
/* Pause the game. */
|
||||
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
|
||||
Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
|
||||
if (!_pause_mode.Test(PauseMode::Normal)) {
|
||||
Command<CMD_PAUSE>::Post(PauseMode::Normal, true);
|
||||
}
|
||||
|
||||
/* Highlight row that matched */
|
||||
|
||||
Reference in New Issue
Block a user