Debug: Show info of all aircraft parts in vehicle debug window

This commit is contained in:
Jonathan G Rennison
2021-10-12 20:35:07 +01:00
parent c64f48f2bd
commit 9254be5b3c

View File

@@ -92,10 +92,26 @@ class NIHVehicle : public NIHelper {
/* virtual */ void ExtraInfo(uint index, std::function<void(const char *)> print) const override
{
char buffer[1024];
Vehicle *v = Vehicle::Get(index);
print("Debug Info:");
seprintf(buffer, lastof(buffer), " Index: %u", index);
this->VehicleInfo(v, print, true);
if (v->type == VEH_AIRCRAFT) {
print("");
print("Shadow:");
this->VehicleInfo(v->Next(), print, false);
if (v->Next()->Next() != nullptr) {
print("");
print("Rotor:");
this->VehicleInfo(v->Next()->Next(), print, false);
}
}
}
void VehicleInfo(Vehicle *v, std::function<void(const char *)> print, bool show_engine) const
{
char buffer[1024];
seprintf(buffer, lastof(buffer), " Index: %u", v->index);
print(buffer);
char *b = buffer;
b += seprintf(b, lastof(buffer), " Flags: ");
@@ -297,6 +313,7 @@ class NIHVehicle : public NIHelper {
}
}
if (show_engine) {
seprintf(buffer, lastof(buffer), " Engine: %u", v->engine_type);
print(buffer);
const Engine *e = Engine::GetIfValid(v->engine_type);
@@ -353,6 +370,7 @@ class NIHVehicle : public NIHelper {
print(buffer);
}
}
}
seprintf(buffer, lastof(buffer), " Current image cacheable: %s (%X), spritenum: %X",
v->cur_image_valid_dir != INVALID_DIR ? "yes" : "no", v->cur_image_valid_dir, v->spritenum);