(svn r12878) [NewGRF_ports] -Change: Added test for IsEndTakeoffState to detect if any of the 4 takeoff states are current.
--- a/src/aircraft.h Thu Apr 24 21:52:22 2008 +0000
+++ b/src/aircraft.h Thu Apr 24 21:53:20 2008 +0000
@@ -9,6 +9,7 @@
#include "station_base.h"
#include "vehicle_base.h"
#include "engine_func.h"
+#include "airport.h"
/** An aircraft can be one ot those types */
enum AircraftSubType {
@@ -34,6 +35,25 @@
return (v->subtype & 0x07) <= AIR_AIRCRAFT;
}
+/** Check if the aircraft state is a takeoff
+ * @param v vehicle to check
+ * @return Returns true if the aircraft state is a takeoff
+ * false if it is any other state) */
+static inline bool IsEndTakeoffState(const Vehicle *v)
+{
+ assert(v->type == VEH_AIRCRAFT);
+
+ switch (v->u.air.state) {
+ case ENDTAKEOFF:
+ case SMALLENDTAKEOFF:
+ case HELIENDTAKEOFF:
+ case BLIMPENDTAKEOFF:
+ return true;
+ default:
+ return false;
+ }
+}
+
/** Checks if an aircraft can use the station in question
* @param engine The engine to test
* @param st The station