Debug: Add ahead/behind separation vehicles to vehicle debug window

This commit is contained in:
Jonathan G Rennison
2020-07-08 19:30:26 +01:00
parent c81c805856
commit 2219a1a5b7

View File

@@ -131,6 +131,20 @@ class NIHVehicle : public NIHelper {
print(buffer);
}
extern int SeparationBetween(Vehicle *v1, Vehicle *v2);
if (v->AheadSeparation() != nullptr) {
b = buffer + seprintf(buffer, lastof(buffer), " Ahead separation: %d ticks, %u, ", SeparationBetween(v, v->AheadSeparation()), v->AheadSeparation()->index);
SetDParam(0, v->AheadSeparation()->index);
b = GetString(b, STR_VEHICLE_NAME, lastof(buffer));
print(buffer);
}
if (v->BehindSeparation() != nullptr) {
b = buffer + seprintf(buffer, lastof(buffer), " Behind separation: %d ticks, %u, ", SeparationBetween(v->BehindSeparation(), v), v->BehindSeparation()->index);
SetDParam(0, v->BehindSeparation()->index);
b = GetString(b, STR_VEHICLE_NAME, lastof(buffer));
print(buffer);
}
seprintf(buffer, lastof(buffer), " Engine: %u", v->engine_type);
print(buffer);
const Engine *e = Engine::GetIfValid(v->engine_type);