summaryrefslogtreecommitdiff
path: root/src/aircraft.h
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2007-01-27 12:29:55 +0000
committerDarkvater <Darkvater@openttd.org>2007-01-27 12:29:55 +0000
commit2ff4492abc0a131613a4ec983f862a30b0781029 (patch)
treec85d1c112d4c04fb8079a90418ad3b654765dff3 /src/aircraft.h
parent36039f318d71109eeb693f58661238966fa44e14 (diff)
downloadopenttd-2ff4492abc0a131613a4ec983f862a30b0781029.tar.xz
(svn r8428) -Codechange: Add proper names to aircraft subtypes instead of magic numbers and add a function IsNormalAircraft() which tells us whether the aircraft is in fact some flying device or a rotor/shadow.
Diffstat (limited to 'src/aircraft.h')
-rw-r--r--src/aircraft.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/aircraft.h b/src/aircraft.h
index 4b92d38e3..9a2875f1f 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -6,6 +6,28 @@
#include "station_map.h"
#include "vehicle.h"
+typedef enum AircraftSubTypes {
+ AIR_HELICOPTER = 0,
+ AIR_AIRCRAFT = 2,
+ AIR_SHADOW = 4,
+ AIR_ROTOR = 6
+} AircraftSubType;
+
+
+/** Check if the aircraft type is a normal flying device; eg
+ * not a rotor or a shadow
+ * @param v vehicle to check
+ * @return Returns true if the aircraft is a helicopter/airplane and
+ * false if it is a shadow or a rotor) */
+static inline bool IsNormalAircraft(const Vehicle *v)
+{
+ assert(v->type == VEH_Aircraft);
+ /* To be fully correct the commented out functionality is the proper one,
+ * but since value can only be 0 or 2, it is sufficient to only check <= 2
+ * return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
+ return v->subtype <= AIR_AIRCRAFT;
+}
+
static inline bool IsAircraftInHangar(const Vehicle* v)
{