# HG changeset patch # User richk # Date 1209087573 0 # Node ID 14c21d416900d00151c71445c43bcc926e6df389 # Parent 3d5a7bddcea66818a84dcf5477f96b00e6b1c78e (svn r12886) [NewGRF_ports] -Change: Added test for IsInFlight to detect if an aircraft is flying between airports, or is in the main body of the FSM. diff -r 3d5a7bddcea6 -r 14c21d416900 src/aircraft.h --- a/src/aircraft.h Thu Apr 24 21:53:20 2008 +0000 +++ b/src/aircraft.h Fri Apr 25 01:39:33 2008 +0000 @@ -54,6 +54,17 @@ } } +/** Check if the aircraft is in flight between airports + * @param v vehicle to check + * @return Returns true if the aircraft is in flight + * false if it is any other state) */ +static inline bool IsInFlight(const Vehicle *v) +{ + assert(v->type == VEH_AIRCRAFT); + return ((v->u.air.pos == v->u.air.previous_pos) && v->u.air.state == FLYING); +} + + /** Checks if an aircraft can use the station in question * @param engine The engine to test * @param st The station