(svn r18807) -Codechange: introduce AirportSpec and move several non-statemachine-related variables to there
This commit is contained in:
196
src/airport.cpp
196
src/airport.cpp
@@ -122,98 +122,9 @@ enum AirportTiles {
|
||||
/* 141-143 used for flag animation */
|
||||
};
|
||||
|
||||
/** Tiles for Country Airfield (small) */
|
||||
static const byte _airport_sections_country[] = {
|
||||
APT_SMALL_BUILDING_1, APT_SMALL_BUILDING_2, APT_SMALL_BUILDING_3, APT_SMALL_DEPOT_SE,
|
||||
APT_GRASS_FENCE_NE_FLAG, APT_GRASS_1, APT_GRASS_2, APT_GRASS_FENCE_SW,
|
||||
APT_RUNWAY_SMALL_FAR_END, APT_RUNWAY_SMALL_MIDDLE, APT_RUNWAY_SMALL_MIDDLE, APT_RUNWAY_SMALL_NEAR_END
|
||||
};
|
||||
#include "table/airport_defaults.h"
|
||||
|
||||
/** Tiles for City Airport (large) */
|
||||
static const byte _airport_sections_town[] = {
|
||||
APT_BUILDING_1, APT_APRON_FENCE_NW, APT_STAND_1, APT_APRON_FENCE_NW, APT_APRON_FENCE_NW, APT_DEPOT_SE,
|
||||
APT_BUILDING_2, APT_PIER, APT_ROUND_TERMINAL, APT_STAND_PIER_NE, APT_APRON, APT_APRON_FENCE_SW,
|
||||
APT_BUILDING_3, APT_STAND, APT_PIER_NW_NE, APT_APRON_S, APT_APRON_HOR, APT_APRON_N_FENCE_SW,
|
||||
APT_RADIO_TOWER_FENCE_NE, APT_APRON_W, APT_APRON_VER_CROSSING_S, APT_APRON_HOR_CROSSING_E, APT_ARPON_N, APT_TOWER_FENCE_SW,
|
||||
APT_EMPTY_FENCE_NE, APT_APRON_S, APT_APRON_HOR_CROSSING_W, APT_APRON_VER_CROSSING_N, APT_APRON_E, APT_RADAR_GRASS_FENCE_SW,
|
||||
APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_1, APT_RUNWAY_2, APT_RUNWAY_3, APT_RUNWAY_4, APT_RUNWAY_END_FENCE_SE
|
||||
};
|
||||
|
||||
/** Tiles for Metropolitain Airport (large) - 2 runways */
|
||||
static const byte _airport_sections_metropolitan[] = {
|
||||
APT_BUILDING_1, APT_APRON_FENCE_NW, APT_STAND_1, APT_APRON_FENCE_NW, APT_APRON_FENCE_NW, APT_DEPOT_SE,
|
||||
APT_BUILDING_2, APT_PIER, APT_ROUND_TERMINAL, APT_STAND_PIER_NE, APT_APRON, APT_APRON_FENCE_SW,
|
||||
APT_BUILDING_3, APT_STAND, APT_PIER_NW_NE, APT_APRON_S, APT_APRON_HOR, APT_APRON_N_FENCE_SW,
|
||||
APT_RADAR_FENCE_NE, APT_APRON, APT_APRON, APT_APRON, APT_APRON, APT_TOWER_FENCE_SW,
|
||||
APT_RUNWAY_END, APT_RUNWAY_5, APT_RUNWAY_5, APT_RUNWAY_5, APT_RUNWAY_5, APT_RUNWAY_END,
|
||||
APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE
|
||||
};
|
||||
|
||||
/** Tiles for International Airport (large) - 2 runways */
|
||||
static const byte _airport_sections_international[] = {
|
||||
APT_RUNWAY_END_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_END_FENCE_NW,
|
||||
APT_RADIO_TOWER_FENCE_NE, APT_APRON, APT_APRON, APT_APRON, APT_APRON, APT_APRON, APT_DEPOT_SE,
|
||||
APT_BUILDING_3, APT_APRON, APT_STAND, APT_BUILDING_2, APT_STAND, APT_APRON, APT_APRON_FENCE_SW,
|
||||
APT_DEPOT_SE, APT_APRON, APT_STAND, APT_BUILDING_2, APT_STAND, APT_APRON, APT_HELIPAD_1,
|
||||
APT_APRON_FENCE_NE, APT_APRON, APT_STAND, APT_TOWER, APT_STAND, APT_APRON, APT_HELIPAD_1,
|
||||
APT_APRON_FENCE_NE, APT_APRON, APT_APRON, APT_APRON, APT_APRON, APT_APRON, APT_RADAR_FENCE_SW,
|
||||
APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE
|
||||
};
|
||||
|
||||
/** Tiles for Intercontinental Airport (vlarge) - 4 runways */
|
||||
static const byte _airport_sections_intercontinental[] = {
|
||||
APT_RADAR_FENCE_NE, APT_RUNWAY_END_FENCE_NE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_END_FENCE_NW_SW,
|
||||
APT_RUNWAY_END_FENCE_NE_NW, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE_SW, APT_APRON_FENCE_NE_SW,
|
||||
APT_APRON_FENCE_NE, APT_SMALL_BUILDING_1, APT_APRON_FENCE_NE, APT_APRON, APT_APRON, APT_APRON, APT_APRON, APT_RADIO_TOWER_FENCE_NE, APT_APRON_FENCE_NE_SW,
|
||||
APT_APRON_FENCE_NE, APT_APRON_HALF_EAST, APT_APRON_FENCE_NE, APT_TOWER, APT_HELIPAD_2, APT_HELIPAD_2, APT_APRON, APT_APRON_FENCE_NW, APT_APRON_FENCE_SW,
|
||||
APT_APRON_FENCE_NE, APT_APRON, APT_APRON, APT_STAND, APT_BUILDING_1, APT_STAND, APT_APRON, APT_LOW_BUILDING, APT_DEPOT_SE,
|
||||
APT_DEPOT_SE, APT_LOW_BUILDING, APT_APRON, APT_STAND, APT_BUILDING_2, APT_STAND, APT_APRON, APT_APRON, APT_APRON_FENCE_SW,
|
||||
APT_APRON_FENCE_NE, APT_APRON, APT_APRON, APT_STAND, APT_BUILDING_3, APT_STAND, APT_APRON, APT_APRON, APT_APRON_FENCE_SW,
|
||||
APT_APRON_FENCE_NE, APT_APRON_FENCE_SE, APT_APRON, APT_STAND, APT_ROUND_TERMINAL, APT_STAND, APT_APRON_FENCE_SW, APT_APRON_HALF_WEST, APT_APRON_FENCE_SW,
|
||||
APT_APRON_FENCE_NE, APT_GRASS_FENCE_NE_FLAG_2, APT_APRON_FENCE_NE, APT_APRON, APT_APRON, APT_APRON, APT_APRON_FENCE_SW, APT_EMPTY, APT_APRON_FENCE_NE_SW,
|
||||
APT_APRON_FENCE_NE, APT_RUNWAY_END_FENCE_NE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_FENCE_NW, APT_RUNWAY_END_FENCE_SE_SW,
|
||||
APT_RUNWAY_END_FENCE_NE_SE, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE_SW, APT_EMPTY
|
||||
};
|
||||
|
||||
|
||||
/** Tiles for Commuter Airfield (small) */
|
||||
static const byte _airport_sections_commuter[] = {
|
||||
APT_TOWER, APT_BUILDING_3, APT_HELIPAD_2_FENCE_NW, APT_HELIPAD_2_FENCE_NW, APT_DEPOT_SE,
|
||||
APT_APRON_FENCE_NE, APT_APRON, APT_APRON, APT_APRON, APT_APRON_FENCE_SW,
|
||||
APT_APRON_FENCE_NE, APT_STAND, APT_STAND, APT_STAND, APT_APRON_FENCE_SW,
|
||||
APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE
|
||||
};
|
||||
|
||||
/** Tiles for Heliport */
|
||||
static const byte _airport_sections_heliport[] = {
|
||||
APT_HELIPORT,
|
||||
};
|
||||
|
||||
/** Tiles for Helidepot */
|
||||
static const byte _airport_sections_helidepot[] = {
|
||||
APT_LOW_BUILDING_FENCE_N, APT_DEPOT_SE,
|
||||
APT_HELIPAD_2_FENCE_NE_SE, APT_APRON_FENCE_SE_SW
|
||||
};
|
||||
|
||||
/** Tiles for Helistation */
|
||||
static const byte _airport_sections_helistation[] = {
|
||||
APT_DEPOT_SE, APT_LOW_BUILDING_FENCE_NW, APT_HELIPAD_3_FENCE_NW, APT_HELIPAD_3_FENCE_NW_SW,
|
||||
APT_APRON_FENCE_NE_SE, APT_APRON_FENCE_SE, APT_APRON_FENCE_SE, APT_HELIPAD_3_FENCE_SE_SW
|
||||
};
|
||||
|
||||
const byte * const _airport_sections[] = {
|
||||
_airport_sections_country, // Country Airfield (small)
|
||||
_airport_sections_town, // City Airport (large)
|
||||
_airport_sections_heliport, // Heliport
|
||||
_airport_sections_metropolitan, // Metropolitain Airport (large)
|
||||
_airport_sections_international, // International Airport (xlarge)
|
||||
_airport_sections_commuter, // Commuter Airport (small)
|
||||
_airport_sections_helidepot, // Helidepot
|
||||
_airport_sections_intercontinental, // Intercontinental Airport (xxlarge)
|
||||
_airport_sections_helistation, // Helistation
|
||||
};
|
||||
|
||||
assert_compile(NUM_AIRPORTS == lengthof(_airport_sections));
|
||||
AirportSpec AirportSpec::dummy = {NULL, NULL, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR};
|
||||
|
||||
/* Uncomment this to print out a full report of the airport-structure
|
||||
* You should either use
|
||||
@@ -244,12 +155,7 @@ void InitializeAirports()
|
||||
_airport_entries_dummy,
|
||||
AirportFTAClass::ALL,
|
||||
_airport_fta_dummy,
|
||||
NULL,
|
||||
0,
|
||||
0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
MAX_YEAR + 1, MAX_YEAR + 1
|
||||
0
|
||||
);
|
||||
|
||||
_country_airport = new AirportFTAClass(
|
||||
@@ -259,12 +165,7 @@ void InitializeAirports()
|
||||
_airport_entries_country,
|
||||
AirportFTAClass::ALL | AirportFTAClass::SHORT_STRIP,
|
||||
_airport_fta_country,
|
||||
_airport_depots_country,
|
||||
lengthof(_airport_depots_country),
|
||||
4, 3, 3,
|
||||
0,
|
||||
4,
|
||||
0, 1959
|
||||
0
|
||||
);
|
||||
|
||||
_city_airport = new AirportFTAClass(
|
||||
@@ -274,12 +175,7 @@ void InitializeAirports()
|
||||
_airport_entries_city,
|
||||
AirportFTAClass::ALL,
|
||||
_airport_fta_city,
|
||||
_airport_depots_city,
|
||||
lengthof(_airport_depots_city),
|
||||
6, 6, 5,
|
||||
0,
|
||||
5,
|
||||
1955, MAX_YEAR
|
||||
0
|
||||
);
|
||||
|
||||
_metropolitan_airport = new AirportFTAClass(
|
||||
@@ -289,12 +185,7 @@ void InitializeAirports()
|
||||
_airport_entries_metropolitan,
|
||||
AirportFTAClass::ALL,
|
||||
_airport_fta_metropolitan,
|
||||
_airport_depots_metropolitan,
|
||||
lengthof(_airport_depots_metropolitan),
|
||||
6, 6, 8,
|
||||
0,
|
||||
6,
|
||||
1980, MAX_YEAR
|
||||
0
|
||||
);
|
||||
|
||||
_international_airport = new AirportFTAClass(
|
||||
@@ -304,12 +195,7 @@ void InitializeAirports()
|
||||
_airport_entries_international,
|
||||
AirportFTAClass::ALL,
|
||||
_airport_fta_international,
|
||||
_airport_depots_international,
|
||||
lengthof(_airport_depots_international),
|
||||
7, 7, 17,
|
||||
0,
|
||||
8,
|
||||
1990, MAX_YEAR
|
||||
0
|
||||
);
|
||||
|
||||
_intercontinental_airport = new AirportFTAClass(
|
||||
@@ -319,12 +205,7 @@ void InitializeAirports()
|
||||
_airport_entries_intercontinental,
|
||||
AirportFTAClass::ALL,
|
||||
_airport_fta_intercontinental,
|
||||
_airport_depots_intercontinental,
|
||||
lengthof(_airport_depots_intercontinental),
|
||||
9, 11, 25,
|
||||
0,
|
||||
10,
|
||||
2002, MAX_YEAR
|
||||
0
|
||||
);
|
||||
|
||||
_heliport = new AirportFTAClass(
|
||||
@@ -334,12 +215,7 @@ void InitializeAirports()
|
||||
_airport_entries_heliport_oilrig,
|
||||
AirportFTAClass::HELICOPTERS,
|
||||
_airport_fta_heliport_oilrig,
|
||||
NULL,
|
||||
0,
|
||||
1, 1, 1,
|
||||
60,
|
||||
4,
|
||||
1963, MAX_YEAR
|
||||
60
|
||||
);
|
||||
|
||||
_oilrig = new AirportFTAClass(
|
||||
@@ -349,12 +225,7 @@ void InitializeAirports()
|
||||
_airport_entries_heliport_oilrig,
|
||||
AirportFTAClass::HELICOPTERS,
|
||||
_airport_fta_heliport_oilrig,
|
||||
NULL,
|
||||
0,
|
||||
1, 1, 0,
|
||||
54,
|
||||
3,
|
||||
MAX_YEAR + 1, MAX_YEAR + 1
|
||||
54
|
||||
);
|
||||
|
||||
_commuter_airport = new AirportFTAClass(
|
||||
@@ -364,12 +235,7 @@ void InitializeAirports()
|
||||
_airport_entries_commuter,
|
||||
AirportFTAClass::ALL | AirportFTAClass::SHORT_STRIP,
|
||||
_airport_fta_commuter,
|
||||
_airport_depots_commuter,
|
||||
lengthof(_airport_depots_commuter),
|
||||
5, 4, 4,
|
||||
0,
|
||||
4,
|
||||
1983, MAX_YEAR
|
||||
0
|
||||
);
|
||||
|
||||
_heli_depot = new AirportFTAClass(
|
||||
@@ -379,12 +245,7 @@ void InitializeAirports()
|
||||
_airport_entries_helidepot,
|
||||
AirportFTAClass::HELICOPTERS,
|
||||
_airport_fta_helidepot,
|
||||
_airport_depots_helidepot,
|
||||
lengthof(_airport_depots_helidepot),
|
||||
2, 2, 2,
|
||||
0,
|
||||
4,
|
||||
1976, MAX_YEAR
|
||||
0
|
||||
);
|
||||
|
||||
_heli_station = new AirportFTAClass(
|
||||
@@ -394,12 +255,7 @@ void InitializeAirports()
|
||||
_airport_entries_helistation,
|
||||
AirportFTAClass::HELICOPTERS,
|
||||
_airport_fta_helistation,
|
||||
_airport_depots_helistation,
|
||||
lengthof(_airport_depots_helistation),
|
||||
4, 2, 3,
|
||||
0,
|
||||
4,
|
||||
1980, MAX_YEAR
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -435,31 +291,15 @@ AirportFTAClass::AirportFTAClass(
|
||||
const byte *entry_points_,
|
||||
Flags flags_,
|
||||
const AirportFTAbuildup *apFA,
|
||||
const TileIndexDiffC *depots_,
|
||||
const byte nof_depots_,
|
||||
uint size_x_,
|
||||
uint size_y_,
|
||||
byte noise_level_,
|
||||
byte delta_z_,
|
||||
byte catchment_,
|
||||
Year first_available_,
|
||||
Year last_available_
|
||||
byte delta_z_
|
||||
) :
|
||||
moving_data(moving_data_),
|
||||
terminals(terminals_),
|
||||
helipads(helipads_),
|
||||
airport_depots(depots_),
|
||||
flags(flags_),
|
||||
nof_depots(nof_depots_),
|
||||
nofelements(AirportGetNofElements(apFA)),
|
||||
entry_points(entry_points_),
|
||||
size_x(size_x_),
|
||||
size_y(size_y_),
|
||||
noise_level(noise_level_),
|
||||
delta_z(delta_z_),
|
||||
catchment(catchment_),
|
||||
first_available(first_available_),
|
||||
last_available(last_available_)
|
||||
delta_z(delta_z_)
|
||||
{
|
||||
byte nofterminalgroups, nofhelipadgroups;
|
||||
|
||||
@@ -519,11 +359,11 @@ AirportFTAClass::~AirportFTAClass()
|
||||
free(layout);
|
||||
}
|
||||
|
||||
bool AirportFTAClass::IsAvailable() const
|
||||
bool AirportSpec::IsAvailable() const
|
||||
{
|
||||
if (_cur_year < this->first_available) return false;
|
||||
if (_cur_year < this->min_year) return false;
|
||||
if (_settings_game.station.never_expire_airports) return true;
|
||||
return _cur_year <= this->last_available;
|
||||
return _cur_year <= this->max_year;
|
||||
}
|
||||
|
||||
/** Get the number of elements of a source Airport state automata
|
||||
|
Reference in New Issue
Block a user