(svn r21975) -Add: console command to reset the engine pool. It removes the traces of engines which are no longer associated to a NewGRF, and can be used to e.g. 'fix' scenarios which were screwed up by the author. You can only use it when there are no vehicles in the game though.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user