summaryrefslogtreecommitdiff
path: root/airport.h
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-09 22:33:00 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-09 22:33:00 +0000
commit6d349b6284f2d7fe65517b03bb310eb508eb3d3a (patch)
treeadf0a3467d8519f1ef67e90a0a06731ea8c4dc1a /airport.h
parentf9fdddb0ad04bb3e1c441884696b08182b82e447 (diff)
downloadopenttd-6d349b6284f2d7fe65517b03bb310eb508eb3d3a.tar.xz
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
- CodeChange: changed the airport gui airport-type checking. Added function GetValidAirports() that returns bitmasked availibility, is also used for checking. - CodeChange: to check tree-planting, 2 const arrays have been moved to table/tree_land.h (type and count) - CodeChange: added IsTownIndex() in following of IsStationIndex(), etc. - Fix (regression): road tunnels did not work anymore, forgot that their type was 0x200 (documented now)
Diffstat (limited to 'airport.h')
-rw-r--r--airport.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/airport.h b/airport.h
index ef68a2f9f..5b0a86907 100644
--- a/airport.h
+++ b/airport.h
@@ -48,4 +48,20 @@ void InitializeAirports(void);
void UnInitializeAirports(void);
const AirportFTAClass* GetAirport(const byte airport_type);
+/** Get buildable airport bitmask.
+ * @return get all buildable airports at this given time, bitmasked.
+ * Bit 0 means the small airport is buildable, etc.
+ * @todo set availability of airports by year, instead of airplane
+ */
+static inline uint32 GetValidAirports(void)
+{
+ uint32 bytemask = _avail_aircraft; /// sets the first 3 bytes, 0 - 2, @see AdjustAvailAircraft()
+
+ // 1980-1-1 is --> 21915
+ // 1990-1-1 is --> 25568
+ if (_date >= 21915) {SETBIT(bytemask, 3);} // metropilitan airport 1980
+ if (_date >= 25568) {SETBIT(bytemask, 4);} // international airport 1990
+ return bytemask;
+}
+
#endif /* AIRPORT_H */