equal
deleted
inserted
replaced
7 #include "debug.h" |
7 #include "debug.h" |
8 #include "map.h" |
8 #include "map.h" |
9 #include "airport.h" |
9 #include "airport.h" |
10 #include "macros.h" |
10 #include "macros.h" |
11 #include "variables.h" |
11 #include "variables.h" |
12 #include "airport_movement.h" |
|
13 #include "date.h" |
12 #include "date.h" |
14 #include "helpers.hpp" |
13 #include "helpers.hpp" |
|
14 #include "newgrf_fsmports.h" |
|
15 #include "airport_movement.h" |
15 |
16 |
16 /* Uncomment this to print out a full report of the airport-structure |
17 /* Uncomment this to print out a full report of the airport-structure |
17 * You should either use |
18 * You should either use |
18 * - true: full-report, print out every state and choice with string-names |
19 * - true: full-report, print out every state and choice with string-names |
19 * OR |
20 * OR |
20 * - false: give a summarized report which only shows current and next position */ |
21 * - false: give a summarized report which only shows current and next position */ |
21 //#define DEBUG_AIRPORT false |
22 //#define DEBUG_AIRPORT false |
22 |
23 |
23 static AirportFTAClass *DummyAirport; |
24 AirportFTAClass *DummyAirport; |
24 static AirportFTAClass *Oilrig; |
25 static AirportFTAClass *Oilrig; |
25 |
26 |
26 |
27 |
27 void InitializeAirports() |
28 void InitializeAirports() |
28 { |
29 { |
324 printf("\n"); |
325 printf("\n"); |
325 } |
326 } |
326 } |
327 } |
327 #endif |
328 #endif |
328 |
329 |
329 const AirportFTAClass *GetAirport(const byte airport_type) |
330 std::list<uint16> GetAvailableAirports() |
330 { |
331 { |
331 //FIXME -- AircraftNextAirportPos_and_Order -> Needs something nicer, don't like this code |
332 std::list<uint16> airports; |
332 // needs constant change if more airports are added |
333 |
333 switch (airport_type) { |
334 for (uint i = 0; i < GetNumFSMportsClasses(); i++) { |
334 default: return DummyAirport; |
335 for (uint j = 0; j < GetNumCustomFSMports((FSMportsClassID)i); j++) { |
335 case AT_OILRIG: return Oilrig; |
336 const FSMportsSpec *spec = GetCustomFSMportsSpec((FSMportsClassID)i, j); |
336 } |
337 |
337 } |
338 if (!HASBIT(spec->callbackmask, CBM_STATION_AVAIL) || |
338 |
339 GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, spec, NULL, INVALID_TILE) != 0) { |
339 |
340 airports.push_back(i << 8 | j); |
340 uint32 GetValidAirports() |
341 } |
341 { |
342 } |
342 return 0; |
343 } |
343 } |
344 |
344 |
345 return airports; |
345 |
346 } |
346 |
|