At one of the Airport's Terminals */
| 1578 | |
| 1579 | /** At one of the Airport's Terminals */ |
| 1580 | static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass *apc) |
| 1581 | { |
| 1582 | /* if we just arrived, execute EnterTerminal first */ |
| 1583 | if (v->previous_pos != v->pos) { |
| 1584 | AircraftEventHandler_EnterTerminal(v, apc); |
| 1585 | /* on an airport with helipads, a helicopter will always land there |
| 1586 | * and get serviced at the same time - setting */ |
| 1587 | if (_settings_game.order.serviceathelipad) { |
| 1588 | if (v->subtype == AIR_HELICOPTER && apc->num_helipads > 0) { |
| 1589 | /* an excerpt of ServiceAircraft, without the invisibility stuff */ |
| 1590 | v->date_of_last_service = TimerGameEconomy::date; |
| 1591 | v->date_of_last_service_newgrf = TimerGameCalendar::date; |
| 1592 | v->breakdowns_since_last_service = 0; |
| 1593 | v->reliability = v->GetEngine()->reliability; |
| 1594 | SetWindowDirty(WC_VEHICLE_DETAILS, v->index); |
| 1595 | } |
| 1596 | } |
| 1597 | return; |
| 1598 | } |
| 1599 | |
| 1600 | if (v->current_order.IsType(OT_NOTHING)) return; |
| 1601 | |
| 1602 | /* if the block of the next position is busy, stay put */ |
| 1603 | if (AirportHasBlock(v, &apc->layout[v->pos], apc)) return; |
| 1604 | |
| 1605 | /* airport-road is free. We either have to go to another airport, or to the hangar |
| 1606 | * ---> start moving */ |
| 1607 | |
| 1608 | bool go_to_hangar = false; |
| 1609 | switch (v->current_order.GetType()) { |
| 1610 | case OT_GOTO_STATION: // ready to fly to another airport |
| 1611 | break; |
| 1612 | case OT_GOTO_DEPOT: // visit hangar for servicing, sale, etc. |
| 1613 | go_to_hangar = v->current_order.GetDestination() == v->targetairport; |
| 1614 | break; |
| 1615 | case OT_CONDITIONAL: |
| 1616 | /* In case of a conditional order we just have to wait a tick |
| 1617 | * longer, so the conditional order can actually be processed; |
| 1618 | * we should not clear the order as that makes us go nowhere. */ |
| 1619 | return; |
| 1620 | default: // orders have been deleted (no orders), goto depot and don't bother us |
| 1621 | v->current_order.Free(); |
| 1622 | go_to_hangar = true; |
| 1623 | } |
| 1624 | |
| 1625 | if (go_to_hangar && Station::Get(v->targetairport)->airport.HasHangar()) { |
| 1626 | v->state = HANGAR; |
| 1627 | } else { |
| 1628 | /* airplane goto state takeoff, helicopter to helitakeoff */ |
| 1629 | v->state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF; |
| 1630 | } |
| 1631 | AirportMove(v, apc); |
| 1632 | } |
| 1633 | |
| 1634 | static void AircraftEventHandler_General(Aircraft *, const AirportFTAClass *) |
| 1635 | { |
nothing calls this directly
no test coverage detected