7 #include "airport.h" |
7 #include "airport.h" |
8 #include "macros.h" |
8 #include "macros.h" |
9 #include "variables.h" |
9 #include "variables.h" |
10 #include "airport_movement.h" |
10 #include "airport_movement.h" |
11 |
11 |
12 static AirportFTAClass* CountryAirport; |
12 static AirportFTAClass *CountryAirport; |
13 static AirportFTAClass* CityAirport; |
13 static AirportFTAClass *CityAirport; |
14 static AirportFTAClass* Oilrig; |
14 static AirportFTAClass *Oilrig; |
15 static AirportFTAClass* Heliport; |
15 static AirportFTAClass *Heliport; |
16 static AirportFTAClass* MetropolitanAirport; |
16 static AirportFTAClass *MetropolitanAirport; |
17 static AirportFTAClass* InternationalAirport; |
17 static AirportFTAClass *InternationalAirport; |
18 static AirportFTAClass* CommuterAirport; |
18 static AirportFTAClass *CommuterAirport; |
19 static AirportFTAClass* HeliDepot; |
19 static AirportFTAClass *HeliDepot; |
20 static AirportFTAClass* IntercontinentalAirport; |
20 static AirportFTAClass *IntercontinentalAirport; |
21 static AirportFTAClass* HeliStation; |
21 static AirportFTAClass *HeliStation; |
22 |
22 |
23 static void AirportFTAClass_Constructor(AirportFTAClass *Airport, |
23 static void AirportFTAClass_Constructor(AirportFTAClass *Airport, |
24 const byte *terminals, const byte *helipads, |
24 const byte *terminals, const byte *helipads, |
25 const byte entry_point, const byte acc_planes, |
25 const byte entry_point, const byte acc_planes, |
26 const AirportFTAbuildup *FA, |
26 const AirportFTAbuildup *FA, |
199 ) |
199 ) |
200 { |
200 { |
201 byte nofterminals, nofhelipads; |
201 byte nofterminals, nofhelipads; |
202 byte nofterminalgroups = 0; |
202 byte nofterminalgroups = 0; |
203 byte nofhelipadgroups = 0; |
203 byte nofhelipadgroups = 0; |
204 const byte * curr; |
204 const byte *curr; |
205 int i; |
205 int i; |
206 nofterminals = nofhelipads = 0; |
206 nofterminals = nofhelipads = 0; |
207 |
207 |
208 Airport->size_x = size_x; |
208 Airport->size_x = size_x; |
209 Airport->size_y = size_y; |
209 Airport->size_y = size_y; |
327 current->block = FA[internalcounter].block; |
327 current->block = FA[internalcounter].block; |
328 current->next_position = FA[internalcounter].next_in_chain; |
328 current->next_position = FA[internalcounter].next_in_chain; |
329 |
329 |
330 // outgoing nodes from the same position, create linked list |
330 // outgoing nodes from the same position, create linked list |
331 while (current->position == FA[internalcounter + 1].position) { |
331 while (current->position == FA[internalcounter + 1].position) { |
332 AirportFTA* newNode = malloc(sizeof(AirportFTA)); |
332 AirportFTA *newNode = malloc(sizeof(AirportFTA)); |
333 |
333 |
334 newNode->position = FA[internalcounter + 1].position; |
334 newNode->position = FA[internalcounter + 1].position; |
335 newNode->heading = FA[internalcounter + 1].heading; |
335 newNode->heading = FA[internalcounter + 1].heading; |
336 newNode->block = FA[internalcounter + 1].block; |
336 newNode->block = FA[internalcounter + 1].block; |
337 newNode->next_position = FA[internalcounter + 1].next_in_chain; |
337 newNode->next_position = FA[internalcounter + 1].next_in_chain; |
442 printf("\n"); |
442 printf("\n"); |
443 } |
443 } |
444 } |
444 } |
445 #endif |
445 #endif |
446 |
446 |
447 const AirportFTAClass* GetAirport(const byte airport_type) |
447 const AirportFTAClass *GetAirport(const byte airport_type) |
448 { |
448 { |
449 //FIXME -- AircraftNextAirportPos_and_Order -> Needs something nicer, don't like this code |
449 //FIXME -- AircraftNextAirportPos_and_Order -> Needs something nicer, don't like this code |
450 // needs constant change if more airports are added |
450 // needs constant change if more airports are added |
451 switch (airport_type) { |
451 switch (airport_type) { |
452 default: NOT_REACHED(); |
452 default: NOT_REACHED(); |