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

Function AircraftEntersTerminal

src/aircraft_cmd.cpp:1415–1437  ·  view source on GitHub ↗

* Aircraft arrives at a terminal. If it is the first aircraft, throw a party. * Start loading cargo. * @param v Aircraft that arrived. */

Source from the content-addressed store, hash-verified

1413 * @param v Aircraft that arrived.
1414 */
1415static void AircraftEntersTerminal(Aircraft *v)
1416{
1417 if (v->current_order.IsType(OT_GOTO_DEPOT)) return;
1418
1419 Station *st = Station::Get(v->targetairport);
1420 v->last_station_visited = v->targetairport;
1421
1422 /* Check if station was ever visited before */
1423 if (!(st->had_vehicle_of_type & HVOT_AIRCRAFT)) {
1424 st->had_vehicle_of_type |= HVOT_AIRCRAFT;
1425 /* show newsitem of celebrating citizens */
1426 AddVehicleNewsItem(
1427 GetEncodedString(STR_NEWS_FIRST_AIRCRAFT_ARRIVAL, st->index),
1428 (v->owner == _local_company) ? NewsType::ArrivalCompany : NewsType::ArrivalOther,
1429 v->index,
1430 st->index
1431 );
1432 AI::NewEvent(v->owner, new ScriptEventStationFirstVehicle(st->index, v->index));
1433 Game::NewEvent(new ScriptEventStationFirstVehicle(st->index, v->index));
1434 }
1435
1436 v->BeginLoading();
1437}
1438
1439/**
1440 * Aircraft touched down at the landing strip.

Callers 1

Calls 4

AddVehicleNewsItemFunction · 0.85
IsTypeMethod · 0.80
BeginLoadingMethod · 0.80
GetEncodedStringFunction · 0.70

Tested by

no test coverage detected