Changeset - r14728:03e87eafbf54
[Not reviewed]
master
0 5 0
yexo - 14 years ago 2010-03-05 23:21:41
yexo@openttd.org
(svn r19326) -Codechange: store the airport name as property in AirportSpec
5 files changed with 29 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/airport.cpp
Show inline comments
 
@@ -15,12 +15,13 @@
 
#include "map_type.h"
 
#include "table/airport_movement.h"
 
#include "core/alloc_func.hpp"
 
#include "date_func.h"
 
#include "settings_type.h"
 
#include "newgrf_airport.h"
 
#include "table/strings.h"
 
#include "table/airporttile_ids.h"
 
#include "table/airport_defaults.h"
 

	
 
/* Uncomment this to print out a full report of the airport-structure
 
 * You should either use
 
 * - true: full-report, print out every state and choice with string-names
src/lang/english.txt
Show inline comments
 
@@ -2027,12 +2027,22 @@ STR_STATION_BUILD_AIRPORT_HELISTATION   
 

	
 
STR_STATION_BUILD_AIRPORT_SMALL_AIRPORTS                        :{BLACK}Small airports
 
STR_STATION_BUILD_AIRPORT_LARGE_AIRPORTS                        :{BLACK}Large airports
 
STR_STATION_BUILD_AIRPORT_HUB_AIRPORTS                          :{BLACK}Hub airports
 
STR_STATION_BUILD_AIRPORT_HELIPORTS                             :{BLACK}Helicopter airports
 

	
 
STR_AIRPORT_SMALL                                               :Small
 
STR_AIRPORT_CITY                                                :City
 
STR_AIRPORT_METRO                                               :Metropolitan
 
STR_AIRPORT_INTERNATIONAL                                       :International
 
STR_AIRPORT_COMMUTER                                            :Commuter
 
STR_AIRPORT_INTERCONTINENTAL                                    :Intercontinental
 
STR_AIRPORT_HELIPORT                                            :Heliport
 
STR_AIRPORT_HELIDEPOT                                           :Helidepot
 
STR_AIRPORT_HELISTATION                                         :Helistation
 

	
 
STR_AIRPORT_CLASS_SMALL                                         :Small airports
 
STR_AIRPORT_CLASS_LARGE                                         :Large airports
 
STR_AIRPORT_CLASS_HUB                                           :Hub airports
 
STR_AIRPORT_CLASS_HELIPORTS                                     :Helicopter airports
 

	
 
STR_STATION_BUILD_NOISE                                         :{BLACK}Noise generated: {GOLD}{COMMA}
src/newgrf_airport.cpp
Show inline comments
 
@@ -17,14 +17,14 @@
 
#include "core/alloc_type.hpp"
 
#include "newgrf.h"
 
#include "table/strings.h"
 

	
 
static AirportClass _airport_classes[APC_MAX];
 

	
 
AirportSpec AirportSpec::dummy = {NULL, NULL, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, ATP_TTDP_LARGE, APC_BEGIN};
 
AirportSpec AirportSpec::oilrig = {NULL, NULL, 0, 1, 1, 0, 4, MIN_YEAR, MIN_YEAR, ATP_TTDP_OILRIG, APC_BEGIN};
 
AirportSpec AirportSpec::dummy = {NULL, NULL, 0, 0, 0, 0, 0, MIN_YEAR, MIN_YEAR, STR_NULL, ATP_TTDP_LARGE, APC_BEGIN};
 
AirportSpec AirportSpec::oilrig = {NULL, NULL, 0, 1, 1, 0, 4, MIN_YEAR, MIN_YEAR, STR_NULL, ATP_TTDP_OILRIG, APC_BEGIN};
 

	
 
AirportSpec AirportSpec::specs[NUM_AIRPORTS];
 

	
 
/**
 
 * Retrieve airport spec for the given airport. If an override is available
 
 *  it is returned.
src/newgrf_airport.h
Show inline comments
 
@@ -55,12 +55,13 @@ struct AirportSpec {
 
	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
 
	StringID name;                         ///< name of this airport
 
	TTDPAirportType ttd_airport_type;      ///< ttdpatch airport type (Small/Large/Helipad/Oilrig)
 
	AirportClassID aclass;                 ///< the class to which this airport type belongs
 

	
 
	static const AirportSpec *Get(byte type);
 
	static AirportSpec *GetWithoutOverride(byte type);
 

	
src/table/airport_defaults.h
Show inline comments
 
@@ -374,34 +374,34 @@ static AirportTileTable *_tile_table_hel
 
};
 

	
 
#undef MK
 
#undef MKEND
 

	
 
/** General AirportSpec definition. */
 
#define AS_GENERIC(att, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id) \
 
	{att, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id}
 
#define AS_GENERIC(att, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name) \
 
	{att, depot_tbl, num_depots, size_x, size_y, noise, catchment, min_year, max_year, name, ttdpatch_type, class_id}
 

	
 
/** AirportSpec definition for airports without any depot. */
 
#define AS_ND(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id) \
 
	AS_GENERIC(_tile_table_##ap_name, NULL, 0, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id)
 
#define AS_ND(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name) \
 
	AS_GENERIC(_tile_table_##ap_name, NULL, 0, size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name)
 

	
 
/** AirportSpec definition for airports with at least one depot. */
 
#define AS(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id) \
 
	AS_GENERIC(_tile_table_##ap_name, _airport_depots_##ap_name, lengthof(_airport_depots_##ap_name), size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id)
 
#define AS(ap_name, size_x, size_y, min_year, max_year, catchment, noise, ttdpatch_type, class_id, name) \
 
	AS_GENERIC(_tile_table_##ap_name, _airport_depots_##ap_name, lengthof(_airport_depots_##ap_name), size_x, size_y, noise, catchment, min_year, max_year, ttdpatch_type, class_id, name)
 

	
 
/* The helidepot and helistation have ATP_TTDP_SMALL because they are at ground level */
 
extern const AirportSpec _origin_airport_specs[] = {
 
	AS(country, 4, 3, 0, 1959, 4, 3, ATP_TTDP_SMALL, APC_SMALL),
 
	AS(city, 6, 6, 1955, MAX_YEAR, 5, 5, ATP_TTDP_LARGE, APC_LARGE),
 
	AS_ND(heliport, 1, 1, 1963, MAX_YEAR, 4, 1, ATP_TTDP_HELIPORT, APC_HELIPORT),
 
	AS(metropolitan, 6, 6, 1980, MAX_YEAR, 6, 8, ATP_TTDP_LARGE, APC_LARGE),
 
	AS(international, 7, 7, 1990, MAX_YEAR, 8, 17, ATP_TTDP_LARGE, APC_HUB),
 
	AS(commuter, 5, 4, 1983, MAX_YEAR, 4, 4, ATP_TTDP_SMALL, APC_SMALL),
 
	AS(helidepot, 2, 2, 1976, MAX_YEAR, 4, 2, ATP_TTDP_SMALL, APC_HELIPORT),
 
	AS(intercontinental, 9, 11, 2002, MAX_YEAR, 10, 25, ATP_TTDP_LARGE, APC_HUB),
 
	AS(helistation, 4, 2, 1980, MAX_YEAR, 4, 3, ATP_TTDP_SMALL, APC_HELIPORT),
 
	AS(country, 4, 3, 0, 1959, 4, 3, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_SMALL),
 
	AS(city, 6, 6, 1955, MAX_YEAR, 5, 5, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_CITY),
 
	AS_ND(heliport, 1, 1, 1963, MAX_YEAR, 4, 1, ATP_TTDP_HELIPORT, APC_HELIPORT, STR_AIRPORT_HELIPORT),
 
	AS(metropolitan, 6, 6, 1980, MAX_YEAR, 6, 8, ATP_TTDP_LARGE, APC_LARGE, STR_AIRPORT_METRO),
 
	AS(international, 7, 7, 1990, MAX_YEAR, 8, 17, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERNATIONAL),
 
	AS(commuter, 5, 4, 1983, MAX_YEAR, 4, 4, ATP_TTDP_SMALL, APC_SMALL, STR_AIRPORT_COMMUTER),
 
	AS(helidepot, 2, 2, 1976, MAX_YEAR, 4, 2, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELIDEPOT),
 
	AS(intercontinental, 9, 11, 2002, MAX_YEAR, 10, 25, ATP_TTDP_LARGE, APC_HUB, STR_AIRPORT_INTERCONTINENTAL),
 
	AS(helistation, 4, 2, 1980, MAX_YEAR, 4, 3, ATP_TTDP_SMALL, APC_HELIPORT, STR_AIRPORT_HELISTATION),
 
};
 

	
 
assert_compile(NUM_AIRPORTS == lengthof(_origin_airport_specs));
 

	
 
#undef AS
 
#undef AS_ND
0 comments (0 inline, 0 general)