Debug: Change output format of scope_dumper::VehicleInfo
This commit is contained in:
@@ -62,30 +62,36 @@ const char *scope_dumper::VehicleInfo(const Vehicle *v)
|
||||
auto dump_flags = [&](const Vehicle *u) {
|
||||
b = u->DumpVehicleFlags(b, last, true);
|
||||
};
|
||||
auto dump_name = [&](const Vehicle *u) {
|
||||
if (u->type < VEH_COMPANY_END) {
|
||||
const char *veh_type[] = {
|
||||
"Train",
|
||||
"Road Vehicle",
|
||||
"Ship",
|
||||
"Aircraft",
|
||||
};
|
||||
b = strecpy(b, veh_type[u->type], last, true);
|
||||
if (u->unitnumber > 0) {
|
||||
b += seprintf(b, last, " %u", u->unitnumber);
|
||||
} else {
|
||||
b += seprintf(b, last, " [N/A]");
|
||||
}
|
||||
if (!u->name.empty()) {
|
||||
b += seprintf(b, last, " (%s)", u->name.c_str());
|
||||
}
|
||||
} else if (u->type == VEH_EFFECT) {
|
||||
b += seprintf(b, last, "Effect Vehicle: subtype: %u", u->subtype);
|
||||
} else if (u->type == VEH_DISASTER) {
|
||||
b += seprintf(b, last, "Disaster Vehicle: subtype: %u", u->subtype);
|
||||
}
|
||||
};
|
||||
if (v) {
|
||||
b += seprintf(b, last, "veh: %u: (", v->index);
|
||||
if (Vehicle::GetIfValid(v->index) != v) {
|
||||
b += seprintf(b, last, "INVALID PTR: %p)", v);
|
||||
return this->buffer;
|
||||
}
|
||||
switch (v->type) {
|
||||
case VEH_EFFECT:
|
||||
b += seprintf(b, last, "Effect Vehicle: subtype: %u", v->subtype);
|
||||
break;
|
||||
|
||||
case VEH_DISASTER:
|
||||
b += seprintf(b, last, "Disaster Vehicle: subtype: %u", v->subtype);
|
||||
break;
|
||||
|
||||
default:
|
||||
SetDParam(0, v->index);
|
||||
b = strecpy(b, GetString(STR_VEHICLE_NAME).c_str(), last);
|
||||
break;
|
||||
}
|
||||
if (v->type < VEH_COMPANY_END) {
|
||||
const char veh_type_chars[] = "TRSA";
|
||||
b += seprintf(b, last, ", (%c%u)", veh_type_chars[v->type], v->unitnumber);
|
||||
}
|
||||
dump_name(v);
|
||||
b += seprintf(b, last, ", c:%d, ", (int) v->owner);
|
||||
dump_flags(v);
|
||||
if (v->First() && v->First() != v) {
|
||||
@@ -94,8 +100,7 @@ const char *scope_dumper::VehicleInfo(const Vehicle *v)
|
||||
b += seprintf(b, last, "INVALID PTR: %p)", v->First());
|
||||
return this->buffer;
|
||||
}
|
||||
SetDParam(0, v->First()->index);
|
||||
b = strecpy(b, GetString(STR_VEHICLE_NAME).c_str(), last);
|
||||
dump_name(v->First());
|
||||
b += seprintf(b, last, ", ");
|
||||
dump_flags(v->First());
|
||||
b += seprintf(b, last, ")");
|
||||
|
Reference in New Issue
Block a user