diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 1beb01cbb6..92ccf03461 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -4128,6 +4128,23 @@ DEF_CONSOLE_CMD(ConFindNonRealisticBrakingSignal) return true; } +DEF_CONSOLE_CMD(ConFindMissingObject) +{ + if (argc == 0) { + IConsolePrint(CC_HELP, "Find the next object tile where the spec is missing"); + return true; + } + + extern TileIndex FindMissingObjectTile(); + TileIndex t = FindMissingObjectTile(); + if (t != INVALID_TILE) { + ScrollMainWindowToTile(t); + SetRedErrorSquare(t); + } + + return true; +} + DEF_CONSOLE_CMD(ConDumpInfo) { @@ -4324,6 +4341,7 @@ void IConsoleStdLibRegister() IConsole::CmdRegister("fps_wnd", ConFramerateWindow); IConsole::CmdRegister("find_non_realistic_braking_signal", ConFindNonRealisticBrakingSignal); + IConsole::CmdRegister("find_missing_object", ConFindMissingObject); IConsole::CmdRegister("getfulldate", ConGetFullDate, nullptr, true); IConsole::CmdRegister("dump_command_log", ConDumpCommandLog, nullptr, true); diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index a1808b4e9b..5a56e73ac2 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -1294,3 +1294,16 @@ extern const TileTypeProcs _tile_type_object_procs = { GetFoundation_Object, // get_foundation_proc TerraformTile_Object, // terraform_tile_proc }; + +TileIndex FindMissingObjectTile() +{ + for (TileIndex t = 0; t < MapSize(); t++) { + if (IsTileType(t, MP_OBJECT)) { + const Object *obj = Object::GetByTile(t); + const ObjectSpec *spec = ObjectSpec::Get(obj->type); + if (!spec->IsEnabled()) return t; + } + } + + return INVALID_TILE; +}