MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AircraftEventHandler_HeliEndLanding

Function AircraftEventHandler_HeliEndLanding

src/aircraft_cmd.cpp:1747–1763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1745}
1746
1747static void AircraftEventHandler_HeliEndLanding(Aircraft *v, const AirportFTAClass *apc)
1748{
1749 /* next block busy, don't do a thing, just wait */
1750 if (AirportHasBlock(v, &apc->layout[v->pos], apc)) return;
1751
1752 /* if going to helipad (OT_GOTO_STATION) choose one. If airport doesn't have helipads, choose terminal
1753 * 1. in case all terminals/helipads are busy (AirportFindFreeHelipad() returns false) or
1754 * 2. not going for terminal (but depot, no order),
1755 * --> get out of the way to the hangar IF there are terminals on the airport.
1756 * --> else TAKEOFF
1757 * the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
1758 * must go to a hangar. */
1759 if (v->current_order.IsType(OT_GOTO_STATION)) {
1760 if (AirportFindFreeHelipad(v, apc)) return;
1761 }
1762 v->state = Station::Get(v->targetairport)->airport.HasHangar() ? HANGAR : HELITAKEOFF;
1763}
1764
1765/**
1766 * Signature of the aircraft handler function.

Callers

nothing calls this directly

Calls 4

AirportHasBlockFunction · 0.85
AirportFindFreeHelipadFunction · 0.85
IsTypeMethod · 0.80
HasHangarMethod · 0.80

Tested by

no test coverage detected