# airport.h

Go to the documentation of this file.

    00001 /* $Id: airport.h 15718 2009-03-15 00:32:18Z rubidium $ */
    00002
    00005 #ifndef AIRPORT_H
    00006 #define AIRPORT_H
    00007
    00008 #include "direction_type.h"
    00009 #include "map_type.h"
    00010 #include "tile_type.h"
    00011
    00012 enum {MAX_TERMINALS =  10};
    00013 enum {MAX_HELIPADS  =   4};
    00014 enum {MAX_ELEMENTS  = 255};
    00015 enum {MAX_HEADINGS  =  22};
    00016
    00017 /* Airport types */
    00018 enum {
    00019   AT_SMALL         =   0,
    00020   AT_LARGE         =   1,
    00021   AT_HELIPORT      =   2,
    00022   AT_METROPOLITAN  =   3,
    00023   AT_INTERNATIONAL =   4,
    00024   AT_COMMUTER      =   5,
    00025   AT_HELIDEPOT     =   6,
    00026   AT_INTERCON      =   7,
    00027   AT_HELISTATION   =   8,
    00028   AT_OILRIG        =  15,
    00029   AT_DUMMY         = 255
    00030 };
    00031
    00032
    00033 enum {
    00034   AMED_NOSPDCLAMP = 1 << 0,
    00035   AMED_TAKEOFF    = 1 << 1,
    00036   AMED_SLOWTURN   = 1 << 2,
    00037   AMED_LAND       = 1 << 3,
    00038   AMED_EXACTPOS   = 1 << 4,
    00039   AMED_BRAKE      = 1 << 5,
    00040   AMED_HELI_RAISE = 1 << 6,
    00041   AMED_HELI_LOWER = 1 << 7,
    00042   AMED_HOLD       = 1 << 8
    00043 };
    00044
    00045 /* Movement States on Airports (headings target) */
    00046 enum {
    00047   TO_ALL         =  0,
    00048   HANGAR         =  1,
    00049   TERM1          =  2,
    00050   TERM2          =  3,
    00051   TERM3          =  4,
    00052   TERM4          =  5,
    00053   TERM5          =  6,
    00054   TERM6          =  7,
    00055   HELIPAD1       =  8,
    00056   HELIPAD2       =  9,
    00057   TAKEOFF        = 10,
    00058   STARTTAKEOFF   = 11,
    00059   ENDTAKEOFF     = 12,
    00060   HELITAKEOFF    = 13,
    00061   FLYING         = 14,
    00062   LANDING        = 15,
    00063   ENDLANDING     = 16,
    00064   HELILANDING    = 17,
    00065   HELIENDLANDING = 18,
    00066   TERM7          = 19,
    00067   TERM8          = 20,
    00068   HELIPAD3       = 21,
    00069   HELIPAD4       = 22
    00070 };
    00071
    00072 /* Movement Blocks on Airports
    00073  * blocks (eg_airport_flags) */
    00074 static const uint64
    00075   TERM1_block              = 1ULL <<  0,
    00076   TERM2_block              = 1ULL <<  1,
    00077   TERM3_block              = 1ULL <<  2,
    00078   TERM4_block              = 1ULL <<  3,
    00079   TERM5_block              = 1ULL <<  4,
    00080   TERM6_block              = 1ULL <<  5,
    00081   HELIPAD1_block           = 1ULL <<  6,
    00082   HELIPAD2_block           = 1ULL <<  7,
    00083   RUNWAY_IN_OUT_block      = 1ULL <<  8,
    00084   RUNWAY_IN_block          = 1ULL <<  8,
    00085   AIRPORT_BUSY_block       = 1ULL <<  8,
    00086   RUNWAY_OUT_block         = 1ULL <<  9,
    00087   TAXIWAY_BUSY_block       = 1ULL << 10,
    00088   OUT_WAY_block            = 1ULL << 11,
    00089   IN_WAY_block             = 1ULL << 12,
    00090   AIRPORT_ENTRANCE_block   = 1ULL << 13,
    00091   TERM_GROUP1_block        = 1ULL << 14,
    00092   TERM_GROUP2_block        = 1ULL << 15,
    00093   HANGAR2_AREA_block       = 1ULL << 16,
    00094   TERM_GROUP2_ENTER1_block = 1ULL << 17,
    00095   TERM_GROUP2_ENTER2_block = 1ULL << 18,
    00096   TERM_GROUP2_EXIT1_block  = 1ULL << 19,
    00097   TERM_GROUP2_EXIT2_block  = 1ULL << 20,
    00098   PRE_HELIPAD_block        = 1ULL << 21,
    00099
    00100 /* blocks for new airports */
    00101   TERM7_block              = 1ULL << 22,
    00102   TERM8_block              = 1ULL << 23,
    00103   TERM9_block              = 1ULL << 24,
    00104   HELIPAD3_block           = 1ULL << 24,
    00105   TERM10_block             = 1ULL << 25,
    00106   HELIPAD4_block           = 1ULL << 25,
    00107   HANGAR1_AREA_block       = 1ULL << 26,
    00108   OUT_WAY2_block           = 1ULL << 27,
    00109   IN_WAY2_block            = 1ULL << 28,
    00110   RUNWAY_IN2_block         = 1ULL << 29,
    00111   RUNWAY_OUT2_block        = 1ULL << 10,
    00112   HELIPAD_GROUP_block      = 1ULL << 13,
    00113   OUT_WAY_block2           = 1ULL << 31,
    00114 /* end of new blocks */
    00115
    00116   NOTHING_block            = 1ULL << 30;
    00117
    00118 struct AirportMovingData {
    00119   int16 x;
    00120   int16 y;
    00121   uint16 flag;
    00122   DirectionByte direction;
    00123 };
    00124
    00125 struct AirportFTAbuildup;
    00126
    00128 struct AirportFTAClass {
    00129   public:
    00130     enum Flags {
    00131       AIRPLANES   = 0x1,
    00132       HELICOPTERS = 0x2,
    00133       ALL         = AIRPLANES | HELICOPTERS,
    00134       SHORT_STRIP = 0x4
    00135     };
    00136
    00137     AirportFTAClass(
    00138       const AirportMovingData *moving_data,
    00139       const byte *terminals,
    00140       const byte *helipads,
    00141       const byte *entry_points,
    00142       Flags flags,
    00143       const AirportFTAbuildup *apFA,
    00144       const TileIndexDiffC *depots,
    00145       byte nof_depots,
    00146       uint size_x,
    00147       uint size_y,
    00148       uint8 noise_level,
    00149       byte delta_z,
    00150       byte catchment
    00151     );
    00152
    00153     ~AirportFTAClass();
    00154
    00155     const AirportMovingData *MovingData(byte position) const
    00156     {
    00157       assert(position < nofelements);
    00158       return &moving_data[position];
    00159     }
    00160
    00161   const AirportMovingData *moving_data;
    00162   struct AirportFTA *layout;
    00163   const byte *terminals;
    00164   const byte *helipads;
    00165   const TileIndexDiffC *airport_depots;
    00166   Flags flags;
    00167   byte nof_depots;
    00168   byte nofelements;
    00169   const byte *entry_points;
    00170   byte size_x;
    00171   byte size_y;
    00172   uint8 noise_level;
    00173   byte delta_z;
    00174   byte catchment;
    00175 };
    00176
    00177 DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
    00178
    00179
    00180
    00181 struct AirportFTA {
    00182   AirportFTA *next;
    00183   uint64 block;
    00184   byte position;
    00185   byte next_position;
    00186   byte heading;
    00187 };
    00188
    00189 void InitializeAirports();
    00190 void UnInitializeAirports();
    00191 const AirportFTAClass *GetAirport(const byte airport_type);
    00192
    00198 uint32 GetValidAirports();
    00199
    00200 #endif /* AIRPORT_H */