summaryrefslogtreecommitdiff
path: root/src/airport.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-15 12:08:08 +0000
committeryexo <yexo@openttd.org>2010-01-15 12:08:08 +0000
commitd669801f1d18e295e7497eaa19d0398da67bffe8 (patch)
tree38c0215af215420346de054481c93d83f36da482 /src/airport.h
parentc37d69d161d418eaf363588df0ac67e61fd7f23e (diff)
downloadopenttd-d669801f1d18e295e7497eaa19d0398da67bffe8.tar.xz
(svn r18807) -Codechange: introduce AirportSpec and move several non-statemachine-related variables to there
Diffstat (limited to 'src/airport.h')
-rw-r--r--src/airport.h55
1 files changed, 35 insertions, 20 deletions
diff --git a/src/airport.h b/src/airport.h
index 7e6b64de7..65375a9b9 100644
--- a/src/airport.h
+++ b/src/airport.h
@@ -40,6 +40,40 @@ enum {
AT_DUMMY = 255
};
+/* Copy from station_map.h */
+typedef byte StationGfx;
+
+struct AirportTileTable {
+ TileIndexDiffC ti;
+ StationGfx gfx;
+};
+
+/**
+ * Defines the data structure for an airport.
+ */
+struct AirportSpec {
+ const AirportTileTable * const *table; ///< list of the tiles composing the airport
+ const TileIndexDiffC *depot_table; ///< gives the position of the depots on the airports
+ byte nof_depots; ///< the number of depots in this airport
+ byte size_x; ///< size of airport in x direction
+ byte size_y; ///< size of airport in y direction
+ byte noise_level; ///< noise that this airport generates
+ byte catchment; ///< catchment area of this airport
+ Year min_year; ///< first year the airport is available
+ Year max_year; ///< last year the airport is available
+
+ static AirportSpec *Get(byte type)
+ {
+ assert(type < NUM_AIRPORTS);
+ extern AirportSpec _origin_airport_specs[NUM_AIRPORTS];
+ return &_origin_airport_specs[type];
+ }
+
+ bool IsAvailable() const;
+
+ static AirportSpec dummy;
+};
+
enum {
AMED_NOSPDCLAMP = 1 << 0,
@@ -153,15 +187,7 @@ public:
const byte *entry_points,
Flags flags,
const AirportFTAbuildup *apFA,
- const TileIndexDiffC *depots,
- byte nof_depots,
- uint size_x,
- uint size_y,
- uint8 noise_level,
- byte delta_z,
- byte catchment,
- Year first_available,
- Year last_available
+ byte delta_z
);
~AirportFTAClass();
@@ -172,25 +198,14 @@ public:
return &moving_data[position];
}
- /** Is this airport available at this date? */
- bool IsAvailable() const;
-
const AirportMovingData *moving_data;
struct AirportFTA *layout; ///< state machine for airport
const byte *terminals;
const byte *helipads;
- const TileIndexDiffC *airport_depots; ///< gives the position of the depots on the airports
Flags flags;
- byte nof_depots; ///< number of depots this airport has
byte nofelements; ///< number of positions the airport consists of
const byte *entry_points; ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction
- byte size_x;
- byte size_y;
- uint8 noise_level; ///< noise that this airport generates
byte delta_z; ///< Z adjustment for helicopter pads
- byte catchment;
- Year first_available; ///< the year this airport becomes available
- Year last_available; ///< the year this airport expires
};
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)