(svn r16619) -Cleanup: more coding style in airport stuff.

This commit is contained in:
rubidium 2009-06-21 21:05:06 +00:00
parent b07ef35f44
commit 7ed618997f
2 changed files with 71 additions and 71 deletions

View File

@ -178,7 +178,7 @@ static const byte _airport_sections_commuter[] = {
APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE APT_RUNWAY_END_FENCE_SE, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_2, APT_RUNWAY_END_FENCE_SE
}; };
/** Tiles for Heliport */ /** Tiles for _heliport */
static const byte _airport_sections_heliport[] = { static const byte _airport_sections_heliport[] = {
APT_HELIPORT, APT_HELIPORT,
}; };
@ -198,7 +198,7 @@ static const byte _airport_sections_helistation[] = {
const byte * const _airport_sections[] = { const byte * const _airport_sections[] = {
_airport_sections_country, // Country Airfield (small) _airport_sections_country, // Country Airfield (small)
_airport_sections_town, // City Airport (large) _airport_sections_town, // City Airport (large)
_airport_sections_heliport, // Heliport _airport_sections_heliport, // _heliport
_airport_sections_metropolitan, // Metropolitain Airport (large) _airport_sections_metropolitan, // Metropolitain Airport (large)
_airport_sections_international, // International Airport (xlarge) _airport_sections_international, // International Airport (xlarge)
_airport_sections_commuter, // Commuter Airport (small) _airport_sections_commuter, // Commuter Airport (small)
@ -216,22 +216,22 @@ assert_compile(NUM_AIRPORTS == lengthof(_airport_sections));
* - false: give a summarized report which only shows current and next position */ * - false: give a summarized report which only shows current and next position */
//#define DEBUG_AIRPORT false //#define DEBUG_AIRPORT false
static AirportFTAClass *DummyAirport; static AirportFTAClass *_dummy_airport;
static AirportFTAClass *CountryAirport; static AirportFTAClass *_country_airport;
static AirportFTAClass *CityAirport; static AirportFTAClass *_city_airport;
static AirportFTAClass *Oilrig; static AirportFTAClass *_oilrig;
static AirportFTAClass *Heliport; static AirportFTAClass *_heliport;
static AirportFTAClass *MetropolitanAirport; static AirportFTAClass *_metropolitan_airport;
static AirportFTAClass *InternationalAirport; static AirportFTAClass *_international_airport;
static AirportFTAClass *CommuterAirport; static AirportFTAClass *_commuter_airport;
static AirportFTAClass *HeliDepot; static AirportFTAClass *_heli_depot;
static AirportFTAClass *IntercontinentalAirport; static AirportFTAClass *_intercontinental_airport;
static AirportFTAClass *HeliStation; static AirportFTAClass *_heli_station;
void InitializeAirports() void InitializeAirports()
{ {
DummyAirport = new AirportFTAClass( _dummy_airport = new AirportFTAClass(
_airport_moving_data_dummy, _airport_moving_data_dummy,
NULL, NULL,
NULL, NULL,
@ -246,7 +246,7 @@ void InitializeAirports()
MAX_YEAR + 1, MAX_YEAR + 1 MAX_YEAR + 1, MAX_YEAR + 1
); );
CountryAirport = new AirportFTAClass( _country_airport = new AirportFTAClass(
_airport_moving_data_country, _airport_moving_data_country,
_airport_terminal_country, _airport_terminal_country,
NULL, NULL,
@ -261,7 +261,7 @@ void InitializeAirports()
0, 1959 0, 1959
); );
CityAirport = new AirportFTAClass( _city_airport = new AirportFTAClass(
_airport_moving_data_town, _airport_moving_data_town,
_airport_terminal_city, _airport_terminal_city,
NULL, NULL,
@ -276,7 +276,7 @@ void InitializeAirports()
1955, MAX_YEAR 1955, MAX_YEAR
); );
MetropolitanAirport = new AirportFTAClass( _metropolitan_airport = new AirportFTAClass(
_airport_moving_data_metropolitan, _airport_moving_data_metropolitan,
_airport_terminal_metropolitan, _airport_terminal_metropolitan,
NULL, NULL,
@ -291,7 +291,7 @@ void InitializeAirports()
1980, MAX_YEAR 1980, MAX_YEAR
); );
InternationalAirport = new AirportFTAClass( _international_airport = new AirportFTAClass(
_airport_moving_data_international, _airport_moving_data_international,
_airport_terminal_international, _airport_terminal_international,
_airport_helipad_international, _airport_helipad_international,
@ -306,7 +306,7 @@ void InitializeAirports()
1990, MAX_YEAR 1990, MAX_YEAR
); );
IntercontinentalAirport = new AirportFTAClass( _intercontinental_airport = new AirportFTAClass(
_airport_moving_data_intercontinental, _airport_moving_data_intercontinental,
_airport_terminal_intercontinental, _airport_terminal_intercontinental,
_airport_helipad_intercontinental, _airport_helipad_intercontinental,
@ -321,7 +321,7 @@ void InitializeAirports()
2002, MAX_YEAR 2002, MAX_YEAR
); );
Heliport = new AirportFTAClass( _heliport = new AirportFTAClass(
_airport_moving_data_heliport, _airport_moving_data_heliport,
NULL, NULL,
_airport_helipad_heliport_oilrig, _airport_helipad_heliport_oilrig,
@ -336,7 +336,7 @@ void InitializeAirports()
1963, MAX_YEAR 1963, MAX_YEAR
); );
Oilrig = new AirportFTAClass( _oilrig = new AirportFTAClass(
_airport_moving_data_oilrig, _airport_moving_data_oilrig,
NULL, NULL,
_airport_helipad_heliport_oilrig, _airport_helipad_heliport_oilrig,
@ -351,7 +351,7 @@ void InitializeAirports()
MAX_YEAR + 1, MAX_YEAR + 1 MAX_YEAR + 1, MAX_YEAR + 1
); );
CommuterAirport = new AirportFTAClass( _commuter_airport = new AirportFTAClass(
_airport_moving_data_commuter, _airport_moving_data_commuter,
_airport_terminal_commuter, _airport_terminal_commuter,
_airport_helipad_commuter, _airport_helipad_commuter,
@ -366,7 +366,7 @@ void InitializeAirports()
1983, MAX_YEAR 1983, MAX_YEAR
); );
HeliDepot = new AirportFTAClass( _heli_depot = new AirportFTAClass(
_airport_moving_data_helidepot, _airport_moving_data_helidepot,
NULL, NULL,
_airport_helipad_helidepot, _airport_helipad_helidepot,
@ -381,7 +381,7 @@ void InitializeAirports()
1976, MAX_YEAR 1976, MAX_YEAR
); );
HeliStation = new AirportFTAClass( _heli_station = new AirportFTAClass(
_airport_moving_data_helistation, _airport_moving_data_helistation,
NULL, NULL,
_airport_helipad_helistation, _airport_helipad_helistation,
@ -399,16 +399,16 @@ void InitializeAirports()
void UnInitializeAirports() void UnInitializeAirports()
{ {
delete DummyAirport; delete _dummy_airport;
delete CountryAirport; delete _country_airport;
delete CityAirport; delete _city_airport;
delete Heliport; delete _heliport;
delete MetropolitanAirport; delete _metropolitan_airport;
delete InternationalAirport; delete _international_airport;
delete CommuterAirport; delete _commuter_airport;
delete HeliDepot; delete _heli_depot;
delete IntercontinentalAirport; delete _intercontinental_airport;
delete HeliStation; delete _heli_station;
} }
@ -676,16 +676,16 @@ const AirportFTAClass *GetAirport(const byte airport_type)
* needs constant change if more airports are added */ * needs constant change if more airports are added */
switch (airport_type) { switch (airport_type) {
default: NOT_REACHED(); default: NOT_REACHED();
case AT_SMALL: return CountryAirport; case AT_SMALL: return _country_airport;
case AT_LARGE: return CityAirport; case AT_LARGE: return _city_airport;
case AT_METROPOLITAN: return MetropolitanAirport; case AT_METROPOLITAN: return _metropolitan_airport;
case AT_HELIPORT: return Heliport; case AT_HELIPORT: return _heliport;
case AT_OILRIG: return Oilrig; case AT_OILRIG: return _oilrig;
case AT_INTERNATIONAL: return InternationalAirport; case AT_INTERNATIONAL: return _international_airport;
case AT_COMMUTER: return CommuterAirport; case AT_COMMUTER: return _commuter_airport;
case AT_HELIDEPOT: return HeliDepot; case AT_HELIDEPOT: return _heli_depot;
case AT_INTERCON: return IntercontinentalAirport; case AT_INTERCON: return _intercontinental_airport;
case AT_HELISTATION: return HeliStation; case AT_HELISTATION: return _heli_station;
case AT_DUMMY: return DummyAirport; case AT_DUMMY: return _dummy_airport;
} }
} }

View File

@ -131,31 +131,31 @@ struct AirportFTAbuildup;
/** Finite sTate mAchine --> FTA */ /** Finite sTate mAchine --> FTA */
struct AirportFTAClass { struct AirportFTAClass {
public: public:
enum Flags { enum Flags {
AIRPLANES = 0x1, AIRPLANES = 0x1,
HELICOPTERS = 0x2, HELICOPTERS = 0x2,
ALL = AIRPLANES | HELICOPTERS, ALL = AIRPLANES | HELICOPTERS,
SHORT_STRIP = 0x4 SHORT_STRIP = 0x4
}; };
AirportFTAClass( AirportFTAClass(
const AirportMovingData *moving_data, const AirportMovingData *moving_data,
const byte *terminals, const byte *terminals,
const byte *helipads, const byte *helipads,
const byte *entry_points, const byte *entry_points,
Flags flags, Flags flags,
const AirportFTAbuildup *apFA, const AirportFTAbuildup *apFA,
const TileIndexDiffC *depots, const TileIndexDiffC *depots,
byte nof_depots, byte nof_depots,
uint size_x, uint size_x,
uint size_y, uint size_y,
uint8 noise_level, uint8 noise_level,
byte delta_z, byte delta_z,
byte catchment, byte catchment,
Year first_available, Year first_available,
Year last_available Year last_available
); );
~AirportFTAClass(); ~AirportFTAClass();
@ -166,7 +166,7 @@ struct AirportFTAClass {
} }
/** Is this airport available at this date? */ /** Is this airport available at this date? */
bool IsAvailable() const; bool IsAvailable() const;
const AirportMovingData *moving_data; const AirportMovingData *moving_data;
struct AirportFTA *layout; ///< state machine for airport struct AirportFTA *layout; ///< state machine for airport
@ -189,7 +189,7 @@ struct AirportFTAClass {
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags) DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
/** internal structure used in openttd - Finite sTate mAchine --> FTA */ /** Internal structure used in openttd - Finite sTate mAchine --> FTA */
struct AirportFTA { struct AirportFTA {
AirportFTA *next; ///< possible extra movement choices from this position AirportFTA *next; ///< possible extra movement choices from this position
uint64 block; ///< 64 bit blocks (st->airport_flags), should be enough for the most complex airports uint64 block; ///< 64 bit blocks (st->airport_flags), should be enough for the most complex airports