author | Darkvater |
Sun, 15 May 2005 21:50:26 +0000 | |
changeset 1821 | 6b13b0210b07 |
parent 1784 | 6eb3ab1bc33c |
child 2153 | 91e89aa8c299 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef AIRPORT_H |
2 |
#define AIRPORT_H |
|
3 |
||
4 |
#include "airport_movement.h" |
|
5 |
||
6 |
enum {MAX_TERMINALS = 6}; |
|
7 |
enum {MAX_HELIPADS = 2}; |
|
8 |
||
9 |
// Airport types |
|
10 |
enum { |
|
11 |
AT_SMALL = 0, |
|
12 |
AT_LARGE = 1, |
|
13 |
AT_HELIPORT = 2, |
|
14 |
AT_METROPOLITAN = 3, |
|
15 |
AT_INTERNATIONAL = 4, |
|
950
1f6546ea35a3
(svn r1440) -Feature: Allows more flexible airport layouts now, as the number of
celestar
parents:
909
diff
changeset
|
16 |
AT_OILRIG = 15 |
0 | 17 |
}; |
18 |
||
19 |
// do not change unless you change v->subtype too. This aligns perfectly with its current setting |
|
20 |
enum { |
|
21 |
AIRCRAFT_ONLY = 0, |
|
22 |
ALL = 1, |
|
23 |
HELICOPTERS_ONLY = 2 |
|
24 |
}; |
|
25 |
||
26 |
// Finite sTate mAchine --> FTA |
|
27 |
typedef struct AirportFTAClass { |
|
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
0
diff
changeset
|
28 |
byte nofelements; // number of positions the airport consists of |
950
1f6546ea35a3
(svn r1440) -Feature: Allows more flexible airport layouts now, as the number of
celestar
parents:
909
diff
changeset
|
29 |
const byte *terminals; |
1f6546ea35a3
(svn r1440) -Feature: Allows more flexible airport layouts now, as the number of
celestar
parents:
909
diff
changeset
|
30 |
const byte *helipads; |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
0
diff
changeset
|
31 |
byte entry_point; // when an airplane arrives at this airport, enter it at position entry_point |
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
0
diff
changeset
|
32 |
byte acc_planes; // accept airplanes or helicopters or both |
909
81bc9ef93f50
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
699
diff
changeset
|
33 |
const TileIndexDiffC *airport_depots; // gives the position of the depots on the airports |
699
02b8b9c9194f
(svn r1149) Fix hack which abuses first TileIndex of airport depot array as number of depots (similar change as in map branch)
tron
parents:
222
diff
changeset
|
34 |
byte nof_depots; // number of depots this airport has |
222
b88456001397
(svn r223) -Fix: Const correctness and miscellaneous fixes. Thank you Tron for your diligent fixing of warnings (and some possibly bugs) (Tron)
darkvater
parents:
0
diff
changeset
|
35 |
struct AirportFTA *layout; // state machine for airport |
0 | 36 |
} AirportFTAClass; |
37 |
||
38 |
// internal structure used in openttd - Finite sTate mAchine --> FTA |
|
39 |
typedef struct AirportFTA { |
|
40 |
byte position; // the position that an airplane is at |
|
41 |
byte next_position; // next position from this position |
|
42 |
uint32 block; // 32 bit blocks (st->airport_flags), should be enough for the most complex airports |
|
43 |
byte heading; // heading (current orders), guiding an airplane to its target on an airport |
|
44 |
struct AirportFTA *next_in_chain; // possible extra movement choices from this position |
|
45 |
} AirportFTA; |
|
46 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
950
diff
changeset
|
47 |
void InitializeAirports(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
950
diff
changeset
|
48 |
void UnInitializeAirports(void); |
0 | 49 |
const AirportFTAClass* GetAirport(const byte airport_type); |
50 |
||
1784
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
51 |
/** Get buildable airport bitmask. |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
52 |
* @return get all buildable airports at this given time, bitmasked. |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
53 |
* Bit 0 means the small airport is buildable, etc. |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
54 |
* @todo set availability of airports by year, instead of airplane |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
55 |
*/ |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
56 |
static inline uint32 GetValidAirports(void) |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
57 |
{ |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
58 |
uint32 bytemask = _avail_aircraft; /// sets the first 3 bytes, 0 - 2, @see AdjustAvailAircraft() |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
59 |
|
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
60 |
// 1980-1-1 is --> 21915 |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
61 |
// 1990-1-1 is --> 25568 |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
62 |
if (_date >= 21915) {SETBIT(bytemask, 3);} // metropilitan airport 1980 |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
63 |
if (_date >= 25568) {SETBIT(bytemask, 4);} // international airport 1990 |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
64 |
return bytemask; |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
65 |
} |
6eb3ab1bc33c
(svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
Darkvater
parents:
1093
diff
changeset
|
66 |
|
0 | 67 |
#endif /* AIRPORT_H */ |