OpenTTD
newgrf_airport.h
Go to the documentation of this file.
1 /* $Id: newgrf_airport.h 25705 2013-08-09 18:43:44Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef NEWGRF_AIRPORT_H
13 #define NEWGRF_AIRPORT_H
14 
15 #include "airport.h"
16 #include "date_type.h"
17 #include "newgrf_class.h"
18 #include "newgrf_commons.h"
19 #include "tilearea_type.h"
20 
22 typedef byte StationGfx;
23 
28 };
29 
32 private:
35 
36 public:
42  AirportTileTableIterator(const AirportTileTable *att, TileIndex base_tile) : TileIterator(base_tile + ToTileIndexDiff(att->ti)), att(att), base_tile(base_tile)
43  {
44  }
45 
47  {
48  this->att++;
49  if (this->att->ti.x == -0x80) {
50  this->tile = INVALID_TILE;
51  } else {
52  this->tile = this->base_tile + ToTileIndexDiff(this->att->ti);
53  }
54  return *this;
55  }
56 
59  {
60  return this->att->gfx;
61  }
62 
64  {
65  return new AirportTileTableIterator(*this);
66  }
67 };
68 
71  APC_BEGIN = 0,
72  APC_SMALL = 0,
76  APC_MAX = 16,
77 };
78 
81 
82 
88 };
89 
94  byte hangar_num;
95 };
96 
100 struct AirportSpec {
101  const struct AirportFTAClass *fsm;
102  const AirportTileTable * const *table;
104  byte num_table;
106  byte nof_depots;
107  byte size_x;
108  byte size_y;
109  byte noise_level;
110  byte catchment;
118  /* Newgrf data */
119  bool enabled;
121 
122  static const AirportSpec *Get(byte type);
123  static AirportSpec *GetWithoutOverride(byte type);
124 
125  bool IsAvailable() const;
126 
127  static void ResetAirports();
128 
130  byte GetIndex() const
131  {
132  assert(this >= specs && this < endof(specs));
133  return (byte)(this - specs);
134  }
135 
137 
138 private:
140 };
141 
144 
145 void BindAirportSpecs();
146 
147 StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback);
148 
149 #endif /* NEWGRF_AIRPORT_H */