mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Add console command to find objects with missing specs
This commit is contained in:
parent
63758e412c
commit
c3b05c5346
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user