Files
@ r15747:606d1ec00369
Branch filter:
Location: cpp/openttd-patchpack/source/src/airport.h - annotation
r15747:606d1ec00369
6.9 KiB
text/x-c
(svn r20424) -Fix: Rename members of TileContext (TC_NORMAL conflicted with an existing define on MinGW).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r6117:d11b4c5c0aea r6117:d11b4c5c0aea r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r8100:d1eb5523ede7 r14847:17c348b2df58 r5587:034e5e185dc2 r14606:2cf1bcd611f7 r15175:66e0817dc450 r15175:66e0817dc450 r15175:66e0817dc450 r15175:66e0817dc450 r15175:66e0817dc450 r15175:66e0817dc450 r15175:66e0817dc450 r5475:3f5cd13d1b63 r12046:154b978eca1e r15173:a59afd6301a6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r6394:6d3f6c6d16b6 r14724:8f8a60f22bdd r14850:537311950e1a r14850:537311950e1a r14851:b3915c863ff3 r6394:6d3f6c6d16b6 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r15173:a59afd6301a6 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r6193:8bbff47121cb r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r15173:a59afd6301a6 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r12046:154b978eca1e r12046:154b978eca1e r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r11363:6906c490a00e r11363:6906c490a00e r5995:20322cb12e24 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r5475:3f5cd13d1b63 r12193:b369d1676a33 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r7148:3ab9fa8158b2 r8895:7c3b8ce0ff2f r8895:7c3b8ce0ff2f r7148:3ab9fa8158b2 r12193:b369d1676a33 r5475:3f5cd13d1b63 r7148:3ab9fa8158b2 r5475:3f5cd13d1b63 r15656:e21174b90f22 r6248:b940b09d7ab8 r15656:e21174b90f22 r15656:e21174b90f22 r15656:e21174b90f22 r15656:e21174b90f22 r6248:b940b09d7ab8 r5475:3f5cd13d1b63 r15692:f9728a8c5d5d r15692:f9728a8c5d5d r5932:77e061b150ef r5932:77e061b150ef r8895:7c3b8ce0ff2f r6248:b940b09d7ab8 r12195:f1d03d4e105b r15656:e21174b90f22 r12195:f1d03d4e105b r15656:e21174b90f22 r15656:e21174b90f22 r15656:e21174b90f22 r15656:e21174b90f22 r12195:f1d03d4e105b r6024:85f46d5cd57a r12195:f1d03d4e105b r12195:f1d03d4e105b r12195:f1d03d4e105b r12195:f1d03d4e105b r12195:f1d03d4e105b r12195:f1d03d4e105b r12195:f1d03d4e105b r14246:d068045bd82f r12195:f1d03d4e105b r5932:77e061b150ef r12193:b369d1676a33 r5932:77e061b150ef r12193:b369d1676a33 r12193:b369d1676a33 r12193:b369d1676a33 r12193:b369d1676a33 r12193:b369d1676a33 r5924:db4ab5a5371a r5924:db4ab5a5371a r8895:7c3b8ce0ff2f r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r6024:85f46d5cd57a r8895:7c3b8ce0ff2f r6036:f4372a5ba367 r8895:7c3b8ce0ff2f r6248:b940b09d7ab8 r5475:3f5cd13d1b63 r6025:0e6888758571 r6025:0e6888758571 r6025:0e6888758571 r12195:f1d03d4e105b r6248:b940b09d7ab8 r8895:7c3b8ce0ff2f r14849:27386629fac1 r8895:7c3b8ce0ff2f r8895:7c3b8ce0ff2f r8895:7c3b8ce0ff2f r6248:b940b09d7ab8 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r14847:17c348b2df58 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 | /* $Id$ */
/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file airport.h Various declarations for airports */
#ifndef AIRPORT_H
#define AIRPORT_H
#include "direction_type.h"
#include "tile_type.h"
/** Some airport-related constants */
static const uint MAX_TERMINALS = 10; ///< maximum number of terminals per airport
static const uint MAX_HELIPADS = 4; ///< maximum number of helipads per airport
static const uint MAX_ELEMENTS = 255; ///< maximum number of aircraft positions at airport
static const uint NUM_AIRPORTTILES = 256; ///< total number of airport tiles
static const uint NEW_AIRPORTTILE_OFFSET = 74; ///< offset of first newgrf airport tile
static const uint INVALID_AIRPORTTILE = NUM_AIRPORTTILES; ///< id for an invalid airport tile
/** Airport types */
enum AirportTypes {
AT_SMALL = 0,
AT_LARGE = 1,
AT_HELIPORT = 2,
AT_METROPOLITAN = 3,
AT_INTERNATIONAL = 4,
AT_COMMUTER = 5,
AT_HELIDEPOT = 6,
AT_INTERCON = 7,
AT_HELISTATION = 8,
AT_OILRIG = 9,
NEW_AIRPORT_OFFSET = 10,
NUM_AIRPORTS = 128,
AT_INVALID = 254,
AT_DUMMY = 255
};
enum AirportMovingDataFlags {
AMED_NOSPDCLAMP = 1 << 0,
AMED_TAKEOFF = 1 << 1,
AMED_SLOWTURN = 1 << 2,
AMED_LAND = 1 << 3,
AMED_EXACTPOS = 1 << 4,
AMED_BRAKE = 1 << 5,
AMED_HELI_RAISE = 1 << 6,
AMED_HELI_LOWER = 1 << 7,
AMED_HOLD = 1 << 8
};
/* Movement States on Airports (headings target) */
enum AirportMovementStates {
TO_ALL = 0,
HANGAR = 1,
TERM1 = 2,
TERM2 = 3,
TERM3 = 4,
TERM4 = 5,
TERM5 = 6,
TERM6 = 7,
HELIPAD1 = 8,
HELIPAD2 = 9,
TAKEOFF = 10,
STARTTAKEOFF = 11,
ENDTAKEOFF = 12,
HELITAKEOFF = 13,
FLYING = 14,
LANDING = 15,
ENDLANDING = 16,
HELILANDING = 17,
HELIENDLANDING = 18,
TERM7 = 19,
TERM8 = 20,
HELIPAD3 = 21,
HELIPAD4 = 22,
MAX_HEADINGS = 22,
};
/* Movement Blocks on Airports
* blocks (eg_airport_flags) */
static const uint64
TERM1_block = 1ULL << 0,
TERM2_block = 1ULL << 1,
TERM3_block = 1ULL << 2,
TERM4_block = 1ULL << 3,
TERM5_block = 1ULL << 4,
TERM6_block = 1ULL << 5,
HELIPAD1_block = 1ULL << 6,
HELIPAD2_block = 1ULL << 7,
RUNWAY_IN_OUT_block = 1ULL << 8,
RUNWAY_IN_block = 1ULL << 8,
AIRPORT_BUSY_block = 1ULL << 8,
RUNWAY_OUT_block = 1ULL << 9,
TAXIWAY_BUSY_block = 1ULL << 10,
OUT_WAY_block = 1ULL << 11,
IN_WAY_block = 1ULL << 12,
AIRPORT_ENTRANCE_block = 1ULL << 13,
TERM_GROUP1_block = 1ULL << 14,
TERM_GROUP2_block = 1ULL << 15,
HANGAR2_AREA_block = 1ULL << 16,
TERM_GROUP2_ENTER1_block = 1ULL << 17,
TERM_GROUP2_ENTER2_block = 1ULL << 18,
TERM_GROUP2_EXIT1_block = 1ULL << 19,
TERM_GROUP2_EXIT2_block = 1ULL << 20,
PRE_HELIPAD_block = 1ULL << 21,
/* blocks for new airports */
TERM7_block = 1ULL << 22,
TERM8_block = 1ULL << 23,
TERM9_block = 1ULL << 24,
HELIPAD3_block = 1ULL << 24,
TERM10_block = 1ULL << 25,
HELIPAD4_block = 1ULL << 25,
HANGAR1_AREA_block = 1ULL << 26,
OUT_WAY2_block = 1ULL << 27,
IN_WAY2_block = 1ULL << 28,
RUNWAY_IN2_block = 1ULL << 29,
RUNWAY_OUT2_block = 1ULL << 10, ///< note re-uses TAXIWAY_BUSY
HELIPAD_GROUP_block = 1ULL << 13, ///< note re-uses AIRPORT_ENTRANCE
OUT_WAY_block2 = 1ULL << 31,
/* end of new blocks */
NOTHING_block = 1ULL << 30;
/** A single location on an airport where aircraft can move to. */
struct AirportMovingData {
int16 x; ///< x-coordinate of this position
int16 y; ///< y-coordinate of this position
uint16 flag; ///< special flags when moving towards this position
DirectionByte direction; ///< Direction to turn the aircraft after reaching this position.
};
AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Direction rotation, uint num_tiles_x, uint num_tiles_y);
struct AirportFTAbuildup;
/** Finite sTate mAchine --> FTA */
struct AirportFTAClass {
public:
/** Bitmask of airport flags. */
enum Flags {
AIRPLANES = 0x1, ///< Can planes land on this airport type?
HELICOPTERS = 0x2, ///< Can helicopters land on this airport type?
ALL = AIRPLANES | HELICOPTERS, ///< Mask to check for both planes and helicopters.
SHORT_STRIP = 0x4 ///< This airport has a short landing strip, dangerous for fast aircraft.
};
AirportFTAClass(
const AirportMovingData *moving_data,
const byte *terminals,
const byte *helipads,
const byte *entry_points,
Flags flags,
const AirportFTAbuildup *apFA,
byte delta_z
);
~AirportFTAClass();
const AirportMovingData *MovingData(byte position) const
{
assert(position < nofelements);
return &moving_data[position];
}
const AirportMovingData *moving_data;
struct AirportFTA *layout; ///< state machine for airport
const byte *terminals;
const byte *helipads;
Flags flags;
byte nofelements; ///< number of positions the airport consists of
const byte *entry_points; ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction
byte delta_z; ///< Z adjustment for helicopter pads
};
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
/** Internal structure used in openttd - Finite sTate mAchine --> FTA */
struct AirportFTA {
AirportFTA *next; ///< possible extra movement choices from this position
uint64 block; ///< 64 bit blocks (st->airport.flags), should be enough for the most complex airports
byte position; ///< the position that an airplane is at
byte next_position; ///< next position from this position
byte heading; ///< heading (current orders), guiding an airplane to its target on an airport
};
const AirportFTAClass *GetAirport(const byte airport_type);
byte GetVehiclePosOnBuild(TileIndex hangar_tile);
#endif /* AIRPORT_H */
|