summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-09-13 11:00:30 +0000
committerrubidium <rubidium@openttd.org>2008-09-13 11:00:30 +0000
commitab4d0e2dac782818471c1dbf6bd46b119fb9d86c (patch)
tree139579c16d2c25d682fefe1eb49f5e0bd8207fdd
parentdefecbc6ef643bb35e0c853de383af9672fdcb43 (diff)
downloadopenttd-ab4d0e2dac782818471c1dbf6bd46b119fb9d86c.tar.xz
(svn r14309) -Fix [FS#2244]: aircraft frozen above oil rig when the next order is invalid.
-rw-r--r--src/aircraft_cmd.cpp18
1 files changed, 10 insertions, 8 deletions
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);
}