(svn r10895) [NewGRF_ports] -Fix: Only visually leave the hangar if the aircraft can successfully move to its chosen destination. Enables the decision to proceed to based on block reservations in the hangar commands, not in code. NewGRF_ports
authorrichk
Tue, 14 Aug 2007 21:25:25 +0000
branchNewGRF_ports
changeset 6815 eb1059152f5f
parent 6814 69417b3657f1
child 6816 4b02007a9ed5
(svn r10895) [NewGRF_ports] -Fix: Only visually leave the hangar if the aircraft can successfully move to its chosen destination. Enables the decision to proceed to based on block reservations in the hangar commands, not in code.
src/aircraft_cmd.cpp
--- 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 */