Codechange: make GameMode a scoped enum

This commit is contained in:
Rubidium
2026-05-30 23:20:20 +02:00
committed by rubidium42
parent 4b44d0a376
commit 2ff631caa2
87 changed files with 360 additions and 351 deletions
+9 -9
View File
@@ -235,7 +235,7 @@ static ConsoleHookResult ConHookServerOrNoNetwork(bool echo)
static ConsoleHookResult ConHookNewGRFDeveloperTool(bool echo)
{
if (_settings_client.gui.newgrf_developer_tools) {
if (_game_mode == GM_MENU) {
if (_game_mode == GameMode::Menu) {
if (echo) IConsolePrint(CC_ERROR, "This command is only available in-game and in the editor.");
return ConsoleHookResult::Disallow;
}
@@ -271,7 +271,7 @@ static bool ConResetEnginePool(std::span<std::string_view> argv)
return true;
}
if (_game_mode == GM_MENU) {
if (_game_mode == GameMode::Menu) {
IConsolePrint(CC_ERROR, "This command is only available in-game and in the editor.");
return true;
}
@@ -839,7 +839,7 @@ static bool ConPauseGame(std::span<std::string_view> argv)
return true;
}
if (_game_mode == GM_MENU) {
if (_game_mode == GameMode::Menu) {
IConsolePrint(CC_ERROR, "This command is only available in-game and in the editor.");
return true;
}
@@ -862,7 +862,7 @@ static bool ConUnpauseGame(std::span<std::string_view> argv)
return true;
}
if (_game_mode == GM_MENU) {
if (_game_mode == GameMode::Menu) {
IConsolePrint(CC_ERROR, "This command is only available in-game and in the editor.");
return true;
}
@@ -1503,7 +1503,7 @@ static bool ConStartAI(std::span<std::string_view> argv)
return true;
}
if (_game_mode != GM_NORMAL) {
if (_game_mode != GameMode::Normal) {
IConsolePrint(CC_ERROR, "AIs can only be managed in a game.");
return true;
}
@@ -1577,7 +1577,7 @@ static bool ConReloadAI(std::span<std::string_view> argv)
return true;
}
if (_game_mode != GM_NORMAL) {
if (_game_mode != GameMode::Normal) {
IConsolePrint(CC_ERROR, "AIs can only be managed in a game.");
return true;
}
@@ -1621,7 +1621,7 @@ static bool ConStopAI(std::span<std::string_view> argv)
return true;
}
if (_game_mode != GM_NORMAL) {
if (_game_mode != GameMode::Normal) {
IConsolePrint(CC_ERROR, "AIs can only be managed in a game.");
return true;
}
@@ -1909,7 +1909,7 @@ static bool ConExit(std::span<std::string_view> argv)
return true;
}
if (_game_mode == GM_NORMAL && _settings_client.gui.autosave_on_exit) DoExitSave();
if (_game_mode == GameMode::Normal && _settings_client.gui.autosave_on_exit) DoExitSave();
_exit_game = true;
return true;
@@ -1923,7 +1923,7 @@ static bool ConPart(std::span<std::string_view> argv)
return true;
}
if (_game_mode != GM_NORMAL) return false;
if (_game_mode != GameMode::Normal) return false;
if (_network_dedicated) {
IConsolePrint(CC_ERROR, "A dedicated server can not leave the game.");