From ab4d0e2dac782818471c1dbf6bd46b119fb9d86c Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 13 Sep 2008 11:00:30 +0000 Subject: (svn r14309) -Fix [FS#2244]: aircraft frozen above oil rig when the next order is invalid. --- src/aircraft_cmd.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index c09dd852b..a88822f01 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1578,17 +1578,12 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a /* airport-road is free. We either have to go to another airport, or to the hangar * ---> start moving */ + bool go_to_hangar = false; switch (v->current_order.GetType()) { case OT_GOTO_STATION: // ready to fly to another airport - /* airplane goto state takeoff, helicopter to helitakeoff */ - v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF; break; case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc. - if (v->current_order.GetDestination() == v->u.air.targetairport) { - v->u.air.state = HANGAR; - } else { - v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF; - } + go_to_hangar = v->current_order.GetDestination() == v->u.air.targetairport; break; case OT_CONDITIONAL: /* In case of a conditional order we just have to wait a tick @@ -1597,7 +1592,14 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a return; default: // orders have been deleted (no orders), goto depot and don't bother us v->current_order.Free(); - v->u.air.state = HANGAR; + go_to_hangar = GetStation(v->u.air.targetairport)->Airport()->nof_depots != 0; + } + + if (go_to_hangar) { + v->u.air.state = HANGAR; + } else { + /* airplane goto state takeoff, helicopter to helitakeoff */ + v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF; } AirportMove(v, apc); } -- cgit v1.2.3-54-g00ecf