changeset 4842:6f5ded3d25c0 draft

(svn r6768) -Cleanup: For airports change *Airport to *apc (variable naming coding style conformance (AirportFTAClass), *FA to *apFA (to better reflect its type AirportFTAbuildup), and ->next_in_chain into ->next.
author Darkvater <Darkvater@openttd.org>
date Fri, 13 Oct 2006 23:08:55 +0000
parents 0b0283759d52
children 0da2cea7d12a
files aircraft_cmd.c airport.c airport.h airport_movement.h
diffstat 4 files changed, 168 insertions(+), 168 deletions(-) [+]
line wrap: on
line diff
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -26,12 +26,12 @@
 #include "newgrf_sound.h"
 #include "date.h"
 
-static bool AirportMove(Vehicle *v, const AirportFTAClass *Airport);
-static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport);
-static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport);
-static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport);
-static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport);
-static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *Airport);
+static bool AirportMove(Vehicle *v, const AirportFTAClass *apc);
+static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *apc);
+static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *apc);
+static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *apc);
+static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc);
+static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *apc);
 static void CrashAirplane(Vehicle *v);
 
 static void AircraftNextAirportPos_and_Order(Vehicle *v);
@@ -1401,15 +1401,15 @@
 static void AircraftNextAirportPos_and_Order(Vehicle *v)
 {
 	const Station* st;
-	const AirportFTAClass *Airport;
+	const AirportFTAClass *apc;
 
 	if (v->current_order.type == OT_GOTO_STATION ||
 			v->current_order.type == OT_GOTO_DEPOT)
 		v->u.air.targetairport = v->current_order.dest;
 
 	st = GetStation(v->u.air.targetairport);
-	Airport = GetAirport(st->airport_type);
-	v->u.air.pos = v->u.air.previous_pos = Airport->entry_point;
+	apc = GetAirport(st->airport_type);
+	v->u.air.pos = v->u.air.previous_pos = apc->entry_point;
 }
 
 static void AircraftLeaveHangar(Vehicle *v)
@@ -1442,24 +1442,24 @@
 ////////////////////////////////////////////////////////////////////////////////
 ///////////////////   AIRCRAFT MOVEMENT SCHEME  ////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
-static void AircraftEventHandler_EnterTerminal(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_EnterTerminal(Vehicle *v, const AirportFTAClass *apc)
 {
 	AircraftEntersTerminal(v);
-	v->u.air.state = Airport->layout[v->u.air.pos].heading;
+	v->u.air.state = apc->layout[v->u.air.pos].heading;
 }
 
-static void AircraftEventHandler_EnterHangar(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_EnterHangar(Vehicle *v, const AirportFTAClass *apc)
 {
 	VehicleEnterDepot(v);
-	v->u.air.state = Airport->layout[v->u.air.pos].heading;
+	v->u.air.state = apc->layout[v->u.air.pos].heading;
 }
 
 // In an Airport Hangar
-static void AircraftEventHandler_InHangar(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_InHangar(Vehicle *v, const AirportFTAClass *apc)
 {
 	// if we just arrived, execute EnterHangar first
 	if (v->u.air.previous_pos != v->u.air.pos) {
-		AircraftEventHandler_EnterHangar(v, Airport);
+		AircraftEventHandler_EnterHangar(v, apc);
 		return;
 	}
 
@@ -1475,35 +1475,35 @@
 		return;
 
 	// if the block of the next position is busy, stay put
-	if (AirportHasBlock(v, &Airport->layout[v->u.air.pos], Airport)) return;
+	if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
 
 	// We are already at the target airport, we need to find a terminal
 	if (v->current_order.dest == v->u.air.targetairport) {
 		// FindFreeTerminal:
 		// 1. Find a free terminal, 2. Occupy it, 3. Set the vehicle's state to that terminal
 		if (v->subtype != 0) {
-			if (!AirportFindFreeTerminal(v, Airport)) return; // airplane
+			if (!AirportFindFreeTerminal(v, apc)) return; // airplane
 		} else {
-			if (!AirportFindFreeHelipad(v, Airport)) return; // helicopter
+			if (!AirportFindFreeHelipad(v, apc)) return; // helicopter
 		}
 	} else { // Else prepare for launch.
 		// airplane goto state takeoff, helicopter to helitakeoff
 		v->u.air.state = (v->subtype != 0) ? TAKEOFF : HELITAKEOFF;
 	}
 	AircraftLeaveHangar(v);
-	AirportMove(v, Airport);
+	AirportMove(v, apc);
 }
 
 // At one of the Airport's Terminals
-static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *apc)
 {
 	// if we just arrived, execute EnterTerminal first
 	if (v->u.air.previous_pos != v->u.air.pos) {
-		AircraftEventHandler_EnterTerminal(v, Airport);
+		AircraftEventHandler_EnterTerminal(v, apc);
 		// on an airport with helipads, a helicopter will always land there
 		// and get serviced at the same time - patch setting
 		if (_patches.serviceathelipad) {
-			if (v->subtype == 0 && Airport->helipads != NULL) {
+			if (v->subtype == 0 && apc->helipads != NULL) {
 				// an exerpt of ServiceAircraft, without the invisibility stuff
 				v->date_of_last_service = _date;
 				v->breakdowns_since_last_service = 0;
@@ -1517,7 +1517,7 @@
 	if (v->current_order.type == OT_NOTHING) return;
 
 	// if the block of the next position is busy, stay put
-	if (AirportHasBlock(v, &Airport->layout[v->u.air.pos], Airport)) {
+	if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) {
 		return;
 	}
 
@@ -1541,34 +1541,34 @@
 			v->current_order.flags = 0;
 			v->u.air.state = HANGAR;
 	}
-	AirportMove(v, Airport);
+	AirportMove(v, apc);
 }
 
-static void AircraftEventHandler_General(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_General(Vehicle *v, const AirportFTAClass *apc)
 {
 	DEBUG(misc, 0) ("OK, you shouldn't be here, check your Airport Scheme!");
 	assert(0);
 }
 
-static void AircraftEventHandler_TakeOff(Vehicle *v, const AirportFTAClass *Airport) {
+static void AircraftEventHandler_TakeOff(Vehicle *v, const AirportFTAClass *apc) {
 	PlayAircraftSound(v); // play takeoffsound for airplanes
 	v->u.air.state = STARTTAKEOFF;
 }
 
-static void AircraftEventHandler_StartTakeOff(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_StartTakeOff(Vehicle *v, const AirportFTAClass *apc)
 {
 	v->sprite_width = v->sprite_height = 24; // ??? no idea what this is
 	v->u.air.state = ENDTAKEOFF;
 }
 
-static void AircraftEventHandler_EndTakeOff(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_EndTakeOff(Vehicle *v, const AirportFTAClass *apc)
 {
 	v->u.air.state = FLYING;
 	// get the next position to go to, differs per airport
 	AircraftNextAirportPos_and_Order(v);
 }
 
-static void AircraftEventHandler_HeliTakeOff(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_HeliTakeOff(Vehicle *v, const AirportFTAClass *apc)
 {
 	const Player* p = GetPlayer(v->owner);
 	v->sprite_width = v->sprite_height = 24; // ??? no idea what this is
@@ -1589,7 +1589,7 @@
 	}
 }
 
-static void AircraftEventHandler_Flying(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_Flying(Vehicle *v, const AirportFTAClass *apc)
 {
 	Station *st;
 	byte landingtype;
@@ -1602,14 +1602,14 @@
 	// all other airports --> all types of flying devices (ALL)
 	// heliport/oilrig, etc --> no airplanes (HELICOPTERS_ONLY)
 	// runway busy or not allowed to use this airstation, circle
-	if (v->subtype != Airport->acc_planes &&
+	if (v->subtype != apc->acc_planes &&
 			st->airport_tile != 0 &&
 			(st->owner == OWNER_NONE || st->owner == v->owner)) {
 		// {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
 		// if it is an airplane, look for LANDING, for helicopter HELILANDING
 		// it is possible to choose from multiple landing runways, so loop until a free one is found
 		landingtype = (v->subtype != 0) ? LANDING : HELILANDING;
-		current = Airport->layout[v->u.air.pos].next_in_chain;
+		current = apc->layout[v->u.air.pos].next;
 		while (current != NULL) {
 			if (current->heading == landingtype) {
 				// save speed before, since if AirportHasBlock is false, it resets them to 0
@@ -1617,26 +1617,26 @@
 				// hack for speed thingie
 				tcur_speed = v->cur_speed;
 				tsubspeed = v->subspeed;
-				if (!AirportHasBlock(v, current, Airport)) {
+				if (!AirportHasBlock(v, current, apc)) {
 					v->u.air.state = landingtype; // LANDING / HELILANDING
 					// it's a bit dirty, but I need to set position to next position, otherwise
 					// if there are multiple runways, plane won't know which one it took (because
 					// they all have heading LANDING). And also occupy that block!
 					v->u.air.pos = current->next_position;
-					SETBITS(st->airport_flags, Airport->layout[v->u.air.pos].block);
+					SETBITS(st->airport_flags, apc->layout[v->u.air.pos].block);
 					return;
 				}
 				v->cur_speed = tcur_speed;
 				v->subspeed = tsubspeed;
 			}
-			current = current->next_in_chain;
+			current = current->next;
 		}
 	}
 	v->u.air.state = FLYING;
-	v->u.air.pos = Airport->layout[v->u.air.pos].next_position;
+	v->u.air.pos = apc->layout[v->u.air.pos].next_position;
 }
 
-static void AircraftEventHandler_Landing(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_Landing(Vehicle *v, const AirportFTAClass *apc)
 {
 	const Player* p = GetPlayer(v->owner);
 	AircraftLandAirplane(v);  // maybe crash airplane
@@ -1654,32 +1654,32 @@
 	}
 }
 
-static void AircraftEventHandler_HeliLanding(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_HeliLanding(Vehicle *v, const AirportFTAClass *apc)
 {
 	AircraftLand(v); // helicopters don't crash
 	v->u.air.state = HELIENDLANDING;
 }
 
-static void AircraftEventHandler_EndLanding(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_EndLanding(Vehicle *v, const AirportFTAClass *apc)
 {
 	// next block busy, don't do a thing, just wait
-	if (AirportHasBlock(v, &Airport->layout[v->u.air.pos], Airport)) return;
+	if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
 
 	// if going to terminal (OT_GOTO_STATION) choose one
 	// 1. in case all terminals are busy AirportFindFreeTerminal() returns false or
 	// 2. not going for terminal (but depot, no order),
 	// --> get out of the way to the hangar.
 	if (v->current_order.type == OT_GOTO_STATION) {
-		if (AirportFindFreeTerminal(v, Airport)) return;
+		if (AirportFindFreeTerminal(v, apc)) return;
 	}
 	v->u.air.state = HANGAR;
 
 }
 
-static void AircraftEventHandler_HeliEndLanding(Vehicle *v, const AirportFTAClass *Airport)
+static void AircraftEventHandler_HeliEndLanding(Vehicle *v, const AirportFTAClass *apc)
 {
 	// next block busy, don't do a thing, just wait
-	if (AirportHasBlock(v, &Airport->layout[v->u.air.pos], Airport)) return;
+	if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
 
 	// if going to helipad (OT_GOTO_STATION) choose one. If airport doesn't have helipads, choose terminal
 	// 1. in case all terminals/helipads are busy (AirportFindFreeHelipad() returns false) or
@@ -1689,12 +1689,12 @@
 	// the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
 	// must go to a hangar.
 	if (v->current_order.type == OT_GOTO_STATION) {
-		if (AirportFindFreeHelipad(v, Airport)) return;
+		if (AirportFindFreeHelipad(v, apc)) return;
 	}
-	v->u.air.state = (Airport->nof_depots != 0) ? HANGAR : HELITAKEOFF;
+	v->u.air.state = (apc->nof_depots != 0) ? HANGAR : HELITAKEOFF;
 }
 
-typedef void AircraftStateHandler(Vehicle *v, const AirportFTAClass *Airport);
+typedef void AircraftStateHandler(Vehicle *v, const AirportFTAClass *apc);
 static AircraftStateHandler * const _aircraft_state_handlers[] = {
 	AircraftEventHandler_General,        // TO_ALL         =  0
 	AircraftEventHandler_InHangar,       // HANGAR         =  1
@@ -1721,42 +1721,42 @@
 	AircraftEventHandler_AtTerminal,     // HELIPAD4       = 22
 };
 
-static void AirportClearBlock(const Vehicle *v, const AirportFTAClass *Airport)
+static void AirportClearBlock(const Vehicle *v, const AirportFTAClass *apc)
 {
 	// we have left the previous block, and entered the new one. Free the previous block
-	if (Airport->layout[v->u.air.previous_pos].block != Airport->layout[v->u.air.pos].block) {
+	if (apc->layout[v->u.air.previous_pos].block != apc->layout[v->u.air.pos].block) {
 		Station *st = GetStation(v->u.air.targetairport);
 
-		CLRBITS(st->airport_flags, Airport->layout[v->u.air.previous_pos].block);
+		CLRBITS(st->airport_flags, apc->layout[v->u.air.previous_pos].block);
 	}
 }
 
-static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *Airport)
+static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *apc)
 {
 	// if aircraft is not in position, wait until it is
 	if (!AircraftController(v)) return;
 
-	AirportClearBlock(v, Airport);
-	AirportMove(v, Airport); // move aircraft to next position
+	AirportClearBlock(v, apc);
+	AirportMove(v, apc); // move aircraft to next position
 }
 
 // gets pos from vehicle and next orders
-static bool AirportMove(Vehicle *v, const AirportFTAClass *Airport)
+static bool AirportMove(Vehicle *v, const AirportFTAClass *apc)
 {
 	AirportFTA *current;
 	byte prev_pos;
 
 	// error handling
-	if (v->u.air.pos >= Airport->nofelements) {
-		DEBUG(misc, 0) ("position %d is not valid for current airport. Max position is %d", v->u.air.pos, Airport->nofelements-1);
-		assert(v->u.air.pos < Airport->nofelements);
+	if (v->u.air.pos >= apc->nofelements) {
+		DEBUG(misc, 0) ("position %d is not valid for current airport. Max position is %d", v->u.air.pos, apc->nofelements-1);
+		assert(v->u.air.pos < apc->nofelements);
 	}
 
-	current = &Airport->layout[v->u.air.pos];
+	current = &apc->layout[v->u.air.pos];
 	// we have arrived in an important state (eg terminal, hangar, etc.)
 	if (current->heading == v->u.air.state) {
 		prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
-		_aircraft_state_handlers[v->u.air.state](v, Airport);
+		_aircraft_state_handlers[v->u.air.state](v, apc);
 		if (v->u.air.state != FLYING) v->u.air.previous_pos = prev_pos;
 		return true;
 	}
@@ -1764,8 +1764,8 @@
 	v->u.air.previous_pos = v->u.air.pos; // save previous location
 
 	// there is only one choice to move to
-	if (current->next_in_chain == NULL) {
-		if (AirportSetBlocks(v, current, Airport)) {
+	if (current->next == NULL) {
+		if (AirportSetBlocks(v, current, apc)) {
 			v->u.air.pos = current->next_position;
 		} // move to next position
 		return false;
@@ -1775,28 +1775,28 @@
 	// matches our heading
 	do {
 		if (v->u.air.state == current->heading || current->heading == TO_ALL) {
-			if (AirportSetBlocks(v, current, Airport)) {
+			if (AirportSetBlocks(v, current, apc)) {
 				v->u.air.pos = current->next_position;
 			} // move to next position
 			return false;
 		}
-		current = current->next_in_chain;
+		current = current->next;
 	} while (current != NULL);
 
 	DEBUG(misc, 0) ("Cannot move further on Airport...! pos:%d state:%d", v->u.air.pos, v->u.air.state);
-	DEBUG(misc, 0) ("Airport entry point: %d, Vehicle: %d", Airport->entry_point, v->index);
+	DEBUG(misc, 0) ("Airport entry point: %d, Vehicle: %d", apc->entry_point, v->index);
 	assert(0);
 	return false;
 }
 
 // returns true if the road ahead is busy, eg. you must wait before proceeding
-static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport)
+static bool AirportHasBlock(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *apc)
 {
-	const AirportFTA* reference = &Airport->layout[v->u.air.pos];
-	const AirportFTA* next = &Airport->layout[current_pos->next_position];
+	const AirportFTA* reference = &apc->layout[v->u.air.pos];
+	const AirportFTA* next = &apc->layout[current_pos->next_position];
 
 	// same block, then of course we can move
-	if (Airport->layout[current_pos->position].block != next->block) {
+	if (apc->layout[current_pos->position].block != next->block) {
 		const Station* st = GetStation(v->u.air.targetairport);
 		uint32 airport_flags = next->block;
 
@@ -1815,26 +1815,26 @@
 }
 
 // returns true on success. Eg, next block was free and we have occupied it
-static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *Airport)
+static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *apc)
 {
-	AirportFTA* next = &Airport->layout[current_pos->next_position];
-	AirportFTA* reference = &Airport->layout[v->u.air.pos];
+	AirportFTA* next = &apc->layout[current_pos->next_position];
+	AirportFTA* reference = &apc->layout[v->u.air.pos];
 	AirportFTA* current;
 
 	// if the next position is in another block, check it and wait until it is free
-	if ((Airport->layout[current_pos->position].block & next->block) != next->block) {
+	if ((apc->layout[current_pos->position].block & next->block) != next->block) {
 		uint32 airport_flags = next->block;
 		Station* st = GetStation(v->u.air.targetairport);
 		//search for all all elements in the list with the same state, and blocks != N
 		// this means more blocks should be checked/set
 		current = current_pos;
-		if (current == reference) current = current->next_in_chain;
+		if (current == reference) current = current->next;
 		while (current != NULL) {
 			if (current->heading == current_pos->heading && current->block != 0) {
 				airport_flags |= current->block;
 				break;
 			}
-			current = current->next_in_chain;
+			current = current->next;
 		};
 
 		// if the block to be checked is in the next position, then exclude that from
@@ -1868,17 +1868,17 @@
 	return false;
 }
 
-static uint GetNumTerminals(const AirportFTAClass *Airport)
+static uint GetNumTerminals(const AirportFTAClass *apc)
 {
 	uint num = 0;
 	uint i;
 
-	for (i = Airport->terminals[0]; i > 0; i--) num += Airport->terminals[i];
+	for (i = apc->terminals[0]; i > 0; i--) num += apc->terminals[i];
 
 	return num;
 }
 
-static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport)
+static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *apc)
 {
 	AirportFTA *temp;
 	Station *st;
@@ -1893,9 +1893,9 @@
 	 * possible groups are checked (in this case group 1, since that is after group 0). If that
 	 * fails, then attempt fails and plane waits
 	 */
-	if (Airport->terminals[0] > 1) {
+	if (apc->terminals[0] > 1) {
 		st = GetStation(v->u.air.targetairport);
-		temp = Airport->layout[v->u.air.pos].next_in_chain;
+		temp = apc->layout[v->u.air.pos].next;
 		while (temp != NULL) {
 			if (temp->heading == 255) {
 				if (!HASBITS(st->airport_flags, temp->block)) {
@@ -1912,9 +1912,9 @@
 					//that means, sum up all terminals of
 					//groups with lower number
 					for (i = 1; i < target_group; i++)
-						group_start += Airport->terminals[i];
+						group_start += apc->terminals[i];
 
-					group_end = group_start + Airport->terminals[target_group];
+					group_end = group_start + apc->terminals[target_group];
 					if (FreeTerminal(v, group_start, group_end)) return true;
 				}
 			} else {
@@ -1922,34 +1922,34 @@
 				 * So we cannot move */
 				return false;
 			}
-			temp = temp->next_in_chain;
+			temp = temp->next;
 		}
 	}
 
 	// if there is only 1 terminalgroup, all terminals are checked (starting from 0 to max)
-	return FreeTerminal(v, 0, GetNumTerminals(Airport));
+	return FreeTerminal(v, 0, GetNumTerminals(apc));
 }
 
-static uint GetNumHelipads(const AirportFTAClass *Airport)
+static uint GetNumHelipads(const AirportFTAClass *apc)
 {
 	uint num = 0;
 	uint i;
 
-	for (i = Airport->helipads[0]; i > 0; i--) num += Airport->helipads[i];
+	for (i = apc->helipads[0]; i > 0; i--) num += apc->helipads[i];
 
 	return num;
 }
 
 
-static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport)
+static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc)
 {
 	// if an airport doesn't have helipads, use terminals
-	if (Airport->helipads == NULL) return AirportFindFreeTerminal(v, Airport);
+	if (apc->helipads == NULL) return AirportFindFreeTerminal(v, apc);
 
 	// if there are more helicoptergroups, pick one, just as in AirportFindFreeTerminal()
-	if (Airport->helipads[0] > 1) {
+	if (apc->helipads[0] > 1) {
 		const Station* st = GetStation(v->u.air.targetairport);
-		const AirportFTA* temp = Airport->layout[v->u.air.pos].next_in_chain;
+		const AirportFTA* temp = apc->layout[v->u.air.pos].next;
 
 		while (temp != NULL) {
 			if (temp->heading == 255) {
@@ -1967,9 +1967,9 @@
 					//that means, sum up all terminals of
 					//groups with lower number
 					for (i = 1; i < target_group; i++)
-						group_start += Airport->helipads[i];
+						group_start += apc->helipads[i];
 
-					group_end = group_start + Airport->helipads[target_group];
+					group_end = group_start + apc->helipads[target_group];
 					if (FreeTerminal(v, group_start, group_end)) return true;
 				}
 			} else {
@@ -1977,12 +1977,12 @@
 				 * So we cannot move */
 				return false;
 			}
-			temp = temp->next_in_chain;
+			temp = temp->next;
 		}
 	} else {
 		// only 1 helicoptergroup, check all helipads
 		// The blocks for helipads start after the last terminal (MAX_TERMINALS)
-		return FreeTerminal(v, MAX_TERMINALS, GetNumHelipads(Airport) + MAX_TERMINALS);
+		return FreeTerminal(v, MAX_TERMINALS, GetNumHelipads(apc) + MAX_TERMINALS);
 	}
 	return false; // it shouldn't get here anytime, but just to be sure
 }
--- a/airport.c
+++ b/airport.c
@@ -21,20 +21,20 @@
 static AirportFTAClass *IntercontinentalAirport;
 static AirportFTAClass *HeliStation;
 
-static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
+static void AirportFTAClass_Constructor(AirportFTAClass *apc,
 	const byte *terminals, const byte *helipads,
 	const byte entry_point,  const byte acc_planes,
-	const AirportFTAbuildup *FA,
+	const AirportFTAbuildup *apFA,
 	const TileIndexDiffC *depots, const byte nof_depots,
 	uint size_x, uint size_y
 );
-static void AirportFTAClass_Destructor(AirportFTAClass *Airport);
+static void AirportFTAClass_Destructor(AirportFTAClass *apc);
 
-static uint16 AirportGetNofElements(const AirportFTAbuildup *FA);
-static void AirportBuildAutomata(AirportFTAClass *Airport, const AirportFTAbuildup *FA);
-static byte AirportTestFTA(const AirportFTAClass *Airport);
+static uint16 AirportGetNofElements(const AirportFTAbuildup *apFA);
+static void AirportBuildAutomata(AirportFTAClass *apc, const AirportFTAbuildup *apFA);
+static byte AirportTestFTA(const AirportFTAClass *apc);
 #if 0
-static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_report);
+static void AirportPrintOut(const AirportFTAClass *apc, const bool full_report);
 #endif
 
 void InitializeAirports(void)
@@ -191,11 +191,11 @@
 	AirportFTAClass_Destructor(HeliStation);
 }
 
-static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
-																				const byte *terminals, const byte *helipads,
-																				const byte entry_point, const byte acc_planes,
-																				const AirportFTAbuildup *FA,
-																				const TileIndexDiffC *depots, const byte nof_depots,
+static void AirportFTAClass_Constructor(AirportFTAClass *apc,
+	const byte *terminals, const byte *helipads,
+	const byte entry_point, const byte acc_planes,
+	const AirportFTAbuildup *apFA,
+	const TileIndexDiffC *depots, const byte nof_depots,
 	uint size_x, uint size_y
 )
 {
@@ -206,8 +206,8 @@
 	int i;
 	nofterminals = nofhelipads = 0;
 
-	Airport->size_x = size_x;
-	Airport->size_y = size_y;
+	apc->size_x = size_x;
+	apc->size_y = size_y;
 
 	//now we read the number of terminals we have
 	if (terminals != NULL) {
@@ -221,7 +221,7 @@
 		}
 
 	}
-	Airport->terminals = terminals;
+	apc->terminals = terminals;
 
 	//read helipads
 	if (helipads != NULL) {
@@ -235,7 +235,7 @@
 		}
 
 	}
-	Airport->helipads = helipads;
+	apc->helipads = helipads;
 
 	// if there are more terminals than 6, internal variables have to be changed, so don't allow that
 	// same goes for helipads
@@ -248,26 +248,26 @@
 	assert(nofterminals <= MAX_TERMINALS);
 	assert(nofhelipads <= MAX_HELIPADS);
 
-	Airport->nofelements = AirportGetNofElements(FA);
+	apc->nofelements = AirportGetNofElements(apFA);
 	// check
-	if (entry_point >= Airport->nofelements) {printf("Entry point (%2d) must be within the airport positions (which is max %2d)\n", entry_point, Airport->nofelements);}
-	assert(entry_point < Airport->nofelements);
+	if (entry_point >= apc->nofelements) {printf("Entry point (%2d) must be within the airport positions (which is max %2d)\n", entry_point, apc->nofelements);}
+	assert(entry_point < apc->nofelements);
 
-	Airport->acc_planes = acc_planes;
-	Airport->entry_point = entry_point;
-	Airport->airport_depots = depots;
-	Airport->nof_depots = nof_depots;
+	apc->acc_planes = acc_planes;
+	apc->entry_point = entry_point;
+	apc->airport_depots = depots;
+	apc->nof_depots = nof_depots;
 
 
 	// build the state machine
-	AirportBuildAutomata(Airport, FA);
+	AirportBuildAutomata(apc, apFA);
 	DEBUG(misc, 1) ("#Elements %2d; #Terminals %2d in %d group(s); #Helipads %2d in %d group(s); Entry Point %d",
-		Airport->nofelements, nofterminals, nofterminalgroups, nofhelipads, nofhelipadgroups, Airport->entry_point
+		apc->nofelements, nofterminals, nofterminalgroups, nofhelipads, nofhelipadgroups, apc->entry_point
 	);
 
 
 	{
-		byte ret = AirportTestFTA(Airport);
+		byte ret = AirportTestFTA(apc);
 		if (ret != MAX_ELEMENTS) printf("ERROR with element: %d\n", ret - 1);
 		assert(ret == MAX_ELEMENTS);
 	}
@@ -275,94 +275,94 @@
 	// true  -- full info including heading, block, etc
 	// false -- short info, only position and next position
 #if 0
-	AirportPrintOut(Airport, false);
+	AirportPrintOut(apc, false);
 #endif
 }
 
-static void AirportFTAClass_Destructor(AirportFTAClass *Airport)
+static void AirportFTAClass_Destructor(AirportFTAClass *apc)
 {
 	int i;
 	AirportFTA *current, *next;
 
-	for (i = 0; i < Airport->nofelements; i++) {
-		current = Airport->layout[i].next_in_chain;
+	for (i = 0; i < apc->nofelements; i++) {
+		current = apc->layout[i].next;
 		while (current != NULL) {
-			next = current->next_in_chain;
+			next = current->next;
 			free(current);
 			current = next;
 		};
 	}
-	free(Airport->layout);
-	free(Airport);
+	free(apc->layout);
+	free(apc);
 }
 
-static uint16 AirportGetNofElements(const AirportFTAbuildup *FA)
+static uint16 AirportGetNofElements(const AirportFTAbuildup *apFA)
 {
 	int i;
 	uint16 nofelements = 0;
-	int temp = FA[0].position;
+	int temp = apFA[0].position;
 
 	for (i = 0; i < MAX_ELEMENTS; i++) {
-		if (temp != FA[i].position) {
+		if (temp != apFA[i].position) {
 			nofelements++;
-			temp = FA[i].position;
+			temp = apFA[i].position;
 		}
-		if (FA[i].position == MAX_ELEMENTS) break;
+		if (apFA[i].position == MAX_ELEMENTS) break;
 	}
 	return nofelements;
 }
 
-static void AirportBuildAutomata(AirportFTAClass *Airport, const AirportFTAbuildup *FA)
+static void AirportBuildAutomata(AirportFTAClass *apc, const AirportFTAbuildup *apFA)
 {
 	AirportFTA *FAutomata;
 	AirportFTA *current;
 	uint16 internalcounter, i;
-	FAutomata = malloc(sizeof(AirportFTA) * Airport->nofelements);
-	Airport->layout = FAutomata;
+	FAutomata = malloc(sizeof(AirportFTA) * apc->nofelements);
+	apc->layout = FAutomata;
 	internalcounter = 0;
 
-	for (i = 0; i < Airport->nofelements; i++) {
-		current = &Airport->layout[i];
-		current->position = FA[internalcounter].position;
-		current->heading  = FA[internalcounter].heading;
-		current->block    = FA[internalcounter].block;
-		current->next_position = FA[internalcounter].next_in_chain;
+	for (i = 0; i < apc->nofelements; i++) {
+		current = &apc->layout[i];
+		current->position = apFA[internalcounter].position;
+		current->heading  = apFA[internalcounter].heading;
+		current->block    = apFA[internalcounter].block;
+		current->next_position = apFA[internalcounter].next;
 
 		// outgoing nodes from the same position, create linked list
-		while (current->position == FA[internalcounter + 1].position) {
+		while (current->position == apFA[internalcounter + 1].position) {
 			AirportFTA *newNode = malloc(sizeof(AirportFTA));
 
-			newNode->position = FA[internalcounter + 1].position;
-			newNode->heading  = FA[internalcounter + 1].heading;
-			newNode->block    = FA[internalcounter + 1].block;
-			newNode->next_position = FA[internalcounter + 1].next_in_chain;
+			newNode->position = apFA[internalcounter + 1].position;
+			newNode->heading  = apFA[internalcounter + 1].heading;
+			newNode->block    = apFA[internalcounter + 1].block;
+			newNode->next_position = apFA[internalcounter + 1].next;
 			// create link
-			current->next_in_chain = newNode;
-			current = current->next_in_chain;
+			current->next = newNode;
+			current = current->next;
 			internalcounter++;
 		} // while
-		current->next_in_chain = NULL;
+		current->next = NULL;
 		internalcounter++;
 	}
 }
 
-static byte AirportTestFTA(const AirportFTAClass *Airport)
+static byte AirportTestFTA(const AirportFTAClass *apc)
 {
 	byte position, i, next_element;
 	AirportFTA *temp;
 	next_element = 0;
 
-	for (i = 0; i < Airport->nofelements; i++) {
-		position = Airport->layout[i].position;
+	for (i = 0; i < apc->nofelements; i++) {
+		position = apc->layout[i].position;
 		if (position != next_element) return i;
-		temp = &Airport->layout[i];
+		temp = &apc->layout[i];
 
 		do {
 			if (temp->heading > MAX_HEADINGS && temp->heading != 255) return i;
-			if (temp->heading == 0 && temp->next_in_chain != 0) return i;
+			if (temp->heading == 0 && temp->next != 0) return i;
 			if (position != temp->position) return i;
-			if (temp->next_position >= Airport->nofelements) return i;
-			temp = temp->next_in_chain;
+			if (temp->next_position >= apc->nofelements) return i;
+			temp = temp->next;
 		} while (temp != NULL);
 		next_element++;
 	}
@@ -410,14 +410,14 @@
 }
 
 
-static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_report)
+static void AirportPrintOut(const AirportFTAClass *apc, const bool full_report)
 {
 	byte heading;
 	uint i;
 
 	printf("(P = Current Position; NP = Next Position)\n");
-	for (i = 0; i < Airport->nofelements; i++) {
-		const AirportFTA* temp = &Airport->layout[i];
+	for (i = 0; i < apc->nofelements; i++) {
+		const AirportFTA* temp = &apc->layout[i];
 
 		if (full_report) {
 			heading = (temp->heading == 255) ? MAX_HEADINGS + 1 : temp->heading;
@@ -428,8 +428,8 @@
 		} else {
 			printf("P:%2d NP:%2d", temp->position, temp->next_position);
 		}
-		while (temp->next_in_chain != NULL) {
-			temp = temp->next_in_chain;
+		while (temp->next != NULL) {
+			temp = temp->next;
 			if (full_report) {
 				heading = (temp->heading == 255) ? MAX_HEADINGS + 1 : temp->heading;
 				printf("Pos:%2d NPos:%2d Heading:%15s Block:%2d\n",
--- a/airport.h
+++ b/airport.h
@@ -141,11 +141,11 @@
 
 // internal structure used in openttd - Finite sTate mAchine --> FTA
 typedef struct AirportFTA {
-	byte position;                    // the position that an airplane is at
-	byte next_position;               // next position from this position
-	uint32 block;                     // 32 bit blocks (st->airport_flags), should be enough for the most complex airports
-	byte heading;                     // heading (current orders), guiding an airplane to its target on an airport
-	struct AirportFTA *next_in_chain; // possible extra movement choices from this position
+	byte position;           // the position that an airplane is at
+	byte next_position;      // next position from this position
+	uint32 block;            // 32 bit blocks (st->airport_flags), should be enough for the most complex airports
+	byte heading;            // heading (current orders), guiding an airplane to its target on an airport
+	struct AirportFTA *next; // possible extra movement choices from this position
 } AirportFTA;
 
 void InitializeAirports(void);
--- a/airport_movement.h
+++ b/airport_movement.h
@@ -7,10 +7,10 @@
 // state machine input struct (from external file, etc.)
 // Finite sTate mAchine --> FTA
 typedef struct AirportFTAbuildup {
-	byte position;      // the position that an airplane is at
-	byte heading;       // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
-	uint32 block;       // the block this position is on on the airport (st->airport_flags)
-	byte next_in_chain; // next position from this position
+	byte position; // the position that an airplane is at
+	byte heading;  // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
+	uint32 block;  // the block this position is on on the airport (st->airport_flags)
+	byte next;     // next position from this position
 } AirportFTAbuildup;
 
 ///////////////////////////////////////////////////////////////////////