# newgrf_airport.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    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 /* Copy from station_map.h */
    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   byte hangar_num;
    00056 };
    00057
    00061 struct AirportSpec {
    00062   const struct AirportFTAClass *fsm;
    00063   const AirportTileTable * const *table;
    00064   Direction *rotation;
    00065   byte num_table;
    00066   const HangarTileTable *depot_table;
    00067   byte nof_depots;
    00068   byte size_x;
    00069   byte size_y;
    00070   byte noise_level;
    00071   byte catchment;
    00072   Year min_year;
    00073   Year max_year;
    00074   StringID name;
    00075   TTDPAirportType ttd_airport_type;
    00076   AirportClassID cls_id;
    00077   SpriteID preview_sprite;
    00078   /* Newgrf data */
    00079   bool enabled;
    00080   struct GRFFileProps grf_prop;
    00081
    00082   static const AirportSpec *Get(byte type);
    00083   static AirportSpec *GetWithoutOverride(byte type);
    00084
    00085   bool IsAvailable() const;
    00086
    00087   static void ResetAirports();
    00088
    00090   byte GetIndex() const
    00091   {
    00092     assert(this >= specs && this < endof(specs));
    00093     return (byte)(this - specs);
    00094   }
    00095
    00096   static AirportSpec dummy;
    00097
    00098 private:
    00099   static AirportSpec specs[NUM_AIRPORTS];
    00100 };
    00101
    00103 typedef NewGRFClass<AirportSpec, AirportClassID, APC_MAX> AirportClass;
    00104
    00105 void BindAirportSpecs();
    00106
    00107 StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback);
    00108
    00109 #endif /* NEWGRF_AIRPORT_H */