Debug: Log aircraft target airport and movement state name
This commit is contained in:
@@ -145,4 +145,6 @@ void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteS
|
||||
Station *GetTargetAirportIfValid(const Aircraft *v);
|
||||
void HandleMissingAircraftOrders(Aircraft *v);
|
||||
|
||||
const char *AirportMovementStateToString(byte state);
|
||||
|
||||
#endif /* AIRCRAFT_H */
|
||||
|
@@ -2303,3 +2303,37 @@ void UpdateAirplanesOnNewStation(const Station *st)
|
||||
/* Heliports don't have a hangar. Invalidate all go to hangar orders from all aircraft. */
|
||||
if (!st->airport.HasHangar()) RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, st->index, true);
|
||||
}
|
||||
|
||||
const char *AirportMovementStateToString(byte state)
|
||||
{
|
||||
#define AMS(s) case s: return #s;
|
||||
switch (state) {
|
||||
AMS(TO_ALL)
|
||||
AMS(HANGAR)
|
||||
AMS(TERM1)
|
||||
AMS(TERM2)
|
||||
AMS(TERM3)
|
||||
AMS(TERM4)
|
||||
AMS(TERM5)
|
||||
AMS(TERM6)
|
||||
AMS(HELIPAD1)
|
||||
AMS(HELIPAD2)
|
||||
AMS(TAKEOFF)
|
||||
AMS(STARTTAKEOFF)
|
||||
AMS(ENDTAKEOFF)
|
||||
AMS(HELITAKEOFF)
|
||||
AMS(FLYING)
|
||||
AMS(LANDING)
|
||||
AMS(ENDLANDING)
|
||||
AMS(HELILANDING)
|
||||
AMS(HELIENDLANDING)
|
||||
AMS(TERM7)
|
||||
AMS(TERM8)
|
||||
AMS(HELIPAD3)
|
||||
AMS(TERMGROUP)
|
||||
|
||||
default:
|
||||
return "???";
|
||||
}
|
||||
#undef AMS
|
||||
}
|
||||
|
@@ -343,9 +343,15 @@ class NIHVehicle : public NIHelper {
|
||||
}
|
||||
if (v->type == VEH_AIRCRAFT) {
|
||||
const Aircraft *a = Aircraft::From(v);
|
||||
seprintf(buffer, lastof(buffer), " Pos: %u, prev pos: %u, state: %u, flags: 0x%X",
|
||||
a->pos, a->previous_pos, a->state, a->flags);
|
||||
b = buffer + seprintf(buffer, lastof(buffer), " Pos: %u, prev pos: %u, state: %u",
|
||||
a->pos, a->previous_pos, a->state);
|
||||
if (a->IsPrimaryVehicle()) b += seprintf(b, lastof(buffer), " (%s)", AirportMovementStateToString(a->state));
|
||||
b += seprintf(b, lastof(buffer), ", flags: 0x%X", a->flags);
|
||||
output.print(buffer);
|
||||
if (BaseStation::IsValidID(a->targetairport)) {
|
||||
seprintf(buffer, lastof(buffer), " Target airport: %u, %s", a->targetairport, BaseStation::Get(a->targetairport)->GetCachedName());
|
||||
output.print(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
seprintf(buffer, lastof(buffer), " Cached sprite bounds: (%d, %d) to (%d, %d), offs: (%d, %d)",
|
||||
|
Reference in New Issue
Block a user