diff options
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r-- | src/aircraft_cmd.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index d6d99ae24..7c3566372 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -2103,7 +2103,19 @@ void UpdateAirplanesOnNewStation(const Station *st) FOR_ALL_AIRCRAFT(v) { if (!v->IsNormalAircraft() || v->targetairport != st->index) continue; assert(v->state == FLYING); + + Order *o = &v->current_order; + /* The aircraft is heading to a hangar, but the new station doesn't have one, + * or the aircraft can't land on the new station. Cancel current order. */ + if (o->IsType(OT_GOTO_DEPOT) && !(o->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) && o->GetDestination() == st->index && + (!st->airport.HasHangar() || !CanVehicleUseStation(v, st))) { + o->MakeDummy(); + SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); + } v->pos = v->previous_pos = AircraftGetEntryPoint(v, ap, rotation); UpdateAircraftCache(v); } + + /* 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); } |