(svn r18807) -Codechange: introduce AirportSpec and move several non-statemachine-related variables to there

This commit is contained in:
yexo
2010-01-15 12:08:08 +00:00
parent 43dba09df0
commit 84cd40a483
16 changed files with 555 additions and 285 deletions

View File

@@ -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)