diff options
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r-- | src/console_cmds.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 774d2f093..a8e4c3eb8 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -35,6 +35,7 @@ #include "ai/ai_config.hpp" #include "newgrf.h" #include "console_func.h" +#include "engine_base.h" #ifdef ENABLE_NETWORK #include "table/strings.h" @@ -141,6 +142,26 @@ DEF_CONSOLE_CMD(ConResetEngines) return true; } +DEF_CONSOLE_CMD(ConResetEnginePool) +{ + if (argc == 0) { + IConsoleHelp("Reset NewGRF allocations of engine slots. This will remove invalid engine definitions, and might make default engines available again."); + return true; + } + + if (_game_mode == GM_MENU) { + IConsoleError("This command is only available in game and editor."); + return true; + } + + if (!EngineOverrideManager::ResetToCurrentNewGRFConfig()) { + IConsoleError("This can only be done when there are no vehicles in the game."); + return true; + } + + return true; +} + #ifdef _DEBUG DEF_CONSOLE_CMD(ConResetTile) { @@ -1781,6 +1802,7 @@ void IConsoleStdLibRegister() IConsoleCmdRegister("getdate", ConGetDate); IConsoleCmdRegister("quit", ConExit); IConsoleCmdRegister("resetengines", ConResetEngines, ConHookNoNetwork); + IConsoleCmdRegister("reset_enginepool", ConResetEnginePool, ConHookNoNetwork); IConsoleCmdRegister("return", ConReturn); IConsoleCmdRegister("screenshot", ConScreenShot); IConsoleCmdRegister("script", ConScript); |