Add console command to check caches.

This commit is contained in:
Jonathan G Rennison
2017-02-22 02:48:35 +00:00
parent 3813b3ca09
commit adb4463e5e

View File

@@ -1952,6 +1952,26 @@ DEF_CONSOLE_CMD(ConDumpCommandLog)
return true; return true;
} }
DEF_CONSOLE_CMD(ConCheckCaches)
{
if (argc == 0) {
IConsoleHelp("Debug: Check caches");
return true;
}
if (argc > 2) return false;
bool broadcast = (argc == 2 && atoi(argv[1]) > 0 && (!_networking || _network_server));
if (broadcast) {
DoCommandP(0, 0, 0, CMD_DESYNC_CHECK);
} else {
extern void CheckCaches(bool force_check);
CheckCaches(true);
}
return true;
}
#ifdef _DEBUG #ifdef _DEBUG
/****************** /******************
* debug commands * debug commands
@@ -2097,6 +2117,7 @@ void IConsoleStdLibRegister()
IConsoleDebugLibRegister(); IConsoleDebugLibRegister();
#endif #endif
IConsoleCmdRegister("dump_command_log", ConDumpCommandLog, nullptr, true); IConsoleCmdRegister("dump_command_log", ConDumpCommandLog, nullptr, true);
IConsoleCmdRegister("check_caches", ConCheckCaches, nullptr, true);
/* NewGRF development stuff */ /* NewGRF development stuff */
IConsoleCmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool); IConsoleCmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool);