Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef NEWGRF_AIRPORT_H
00013 #define NEWGRF_AIRPORT_H
00014
00015 #include "airport.h"
00016 #include "date_type.h"
00017 #include "map_type.h"
00018 #include "newgrf_class.h"
00019 #include "newgrf_commons.h"
00020 #include "gfx_type.h"
00021
00022
00023 typedef byte StationGfx;
00024
00026 struct AirportTileTable {
00027 TileIndexDiffC ti;
00028 StationGfx gfx;
00029 };
00030
00032 enum AirportClassID {
00033 APC_BEGIN = 0,
00034 APC_SMALL = 0,
00035 APC_LARGE,
00036 APC_HUB,
00037 APC_HELIPORT,
00038 APC_MAX = 16,
00039 };
00040
00042 DECLARE_POSTFIX_INCREMENT(AirportClassID)
00043
00044
00045 enum TTDPAirportType {
00046 ATP_TTDP_SMALL,
00047 ATP_TTDP_LARGE,
00048 ATP_TTDP_HELIPORT,
00049 ATP_TTDP_OILRIG,
00050 };
00051
00053 struct HangarTileTable {
00054 TileIndexDiffC ti;
00055 Direction dir;
00056 byte hangar_num;
00057 };
00058
00062 struct AirportSpec {
00063 const struct AirportFTAClass *fsm;
00064 const AirportTileTable * const *table;
00065 Direction *rotation;
00066 byte num_table;
00067 const HangarTileTable *depot_table;
00068 byte nof_depots;
00069 byte size_x;
00070 byte size_y;
00071 byte noise_level;
00072 byte catchment;
00073 Year min_year;
00074 Year max_year;
00075 StringID name;
00076 TTDPAirportType ttd_airport_type;
00077 AirportClassID cls_id;
00078 SpriteID preview_sprite;
00079
00080 bool enabled;
00081 struct GRFFileProps grf_prop;
00082
00083 static const AirportSpec *Get(byte type);
00084 static AirportSpec *GetWithoutOverride(byte type);
00085
00086 bool IsAvailable() const;
00087
00088 static void ResetAirports();
00089
00091 byte GetIndex() const
00092 {
00093 assert(this >= specs && this < endof(specs));
00094 return (byte)(this - specs);
00095 }
00096
00097 static AirportSpec dummy;
00098
00099 private:
00100 static AirportSpec specs[NUM_AIRPORTS];
00101 };
00102
00104 typedef NewGRFClass<AirportSpec, AirportClassID, APC_MAX> AirportClass;
00105
00106 void BindAirportSpecs();
00107
00108 StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback);
00109
00110 #endif