src/aircraft_cmd.cpp
branchNewGRF_ports
changeset 6815 eb1059152f5f
parent 6809 30fe2ce4145c
child 6821 1e2dd2497cb2
--- a/src/aircraft_cmd.cpp	Tue Aug 14 19:25:47 2007 +0000
+++ b/src/aircraft_cmd.cpp	Tue Aug 14 21:25:25 2007 +0000
@@ -1633,8 +1633,10 @@
 		/* airplane goto state takeoff, helicopter to helitakeoff */
 		v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
 	}
-	AircraftLeaveHangar(v);
+
+	byte prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
 	AirportMove(v, apc);
+	if (v->u.air.pos != prev_pos) AircraftLeaveHangar(v);  //only leave the hangar if we have succeeded in finding another position to move to
 }
 
 /** At one of the Airport's Terminals */