(svn r10956) [NewGRF_ports] -Codechange: start refactoring the airport specific code to be more generic so it can be used for non-aircraft ports too. NewGRF_ports
authorrubidium
Tue, 21 Aug 2007 09:02:06 +0000
branchNewGRF_ports
changeset 6853 b3b8bb6c0a48
parent 6852 acb078280f60
child 6854 92ca286e9466
(svn r10956) [NewGRF_ports] -Codechange: start refactoring the airport specific code to be more generic so it can be used for non-aircraft ports too.
source.list
src/ai/default/default.cpp
src/aircraft_cmd.cpp
src/airport.cpp
src/airport.h
src/fsmport.cpp
src/fsmport.h
src/newgrf.cpp
src/newgrf_fsmports.h
src/station_cmd.cpp
--- a/source.list	Mon Aug 20 23:21:45 2007 +0000
+++ b/source.list	Tue Aug 21 09:02:06 2007 +0000
@@ -23,6 +23,7 @@
 fios.cpp
 fontcache.cpp
 fsmblockmap.cpp
+fsmport.cpp
 genworld.cpp
 gfx.cpp
 gfxinit.cpp
@@ -121,6 +122,7 @@
 fios.h
 fontcache.h
 fsmblockmap.h
+fsmport.h
 functions.h
 genworld.h
 gfx.h
--- a/src/ai/default/default.cpp	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/ai/default/default.cpp	Tue Aug 21 09:02:06 2007 +0000
@@ -3511,7 +3511,7 @@
 
 	/* XXX - Have the AI pick the hangar terminal in an airport. Eg get airport-type
 	 * and offset to the FIRST depot because the AI picks the st->xy tile */
-	tile += ToTileIndexDiff(GetStationByTile(tile)->Airport()->airport_depots[0]);
+	tile += ToTileIndexDiff(GetStationByTile(tile)->Airport()->depots[0]);
 	if (CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) return;
 	loco_id = _new_vehicle_id;
 
--- a/src/aircraft_cmd.cpp	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/aircraft_cmd.cpp	Tue Aug 21 09:02:06 2007 +0000
@@ -417,11 +417,11 @@
 			TileIndexDiffC depots;
 			if (IsCustomFSMportsSpecIndex(tile)) {
 				apc = st->fsmportsspeclist[1].spec->portFSM;
-				depots = RotateFSMPosition(apc->airport_depots[i], st->fsmportsspeclist[1].spec->size_x[st->FSMport_layout_set],
+				depots = RotateFSMPosition(apc->depots[i], st->fsmportsspeclist[1].spec->size_x[st->FSMport_layout_set],
 										   st->fsmportsspeclist[1].spec->size_y[st->FSMport_layout_set], st->FSMport_orientation);
 			} else {
 				apc = st->Airport();
-				depots = apc->airport_depots[i];
+				depots = apc->depots[i];
 			}
 
 			assert(i != apc->nof_depots);  //asserts if depot not found
@@ -1084,7 +1084,7 @@
 		tile = st->xy;
 
 		/* Jump into our "holding pattern" state machine if possible */
-	if (v->u.air.pos >= afc->nofelements) v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, afc);
+	if (v->u.air.pos >= afc->nof_elements) v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, afc);
 	}
 
 	/* get airport moving data */
@@ -1959,9 +1959,9 @@
 	Station *st = GetStation(v->u.air.targetairport);
 
 	/* error handling */
-	if (v->u.air.pos >= apc->nofelements) {
-		DEBUG(misc, 0, "[Ap] 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);
+	if (v->u.air.pos >= apc->nof_elements) {
+		DEBUG(misc, 0, "[Ap] position %d is not valid for current airport. Max position is %d", v->u.air.pos, apc->nof_elements-1);
+		assert(v->u.air.pos < apc->nof_elements);
 	}
 
 	AirportFTA *current = &apc->layout[v->u.air.pos];
@@ -2298,7 +2298,7 @@
 					byte takeofftype = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : ENDTAKEOFF;
 					/* search in airportdata for that heading
 					 * easiest to do, since this doesn't happen a lot */
-					for (uint cnt = 0; cnt < ap->nofelements; cnt++) {
+					for (uint cnt = 0; cnt < ap->nof_elements; cnt++) {
 						if (ap->layout[cnt].heading == takeofftype) {
 							v->u.air.pos = ap->layout[cnt].position;
 							UpdateAircraftCache(v);
--- a/src/airport.cpp	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/airport.cpp	Tue Aug 21 09:02:06 2007 +0000
@@ -20,96 +20,16 @@
  * - false: give a summarized report which only shows current and next position */
 //#define DEBUG_AIRPORT false
 
-static uint16 AirportGetNofElements(const AirportFTAbuildup *apFA);
-static AirportFTA* AirportBuildAutomata(uint nofelements, const AirportFTAbuildup *apFA);
-static byte AirportGetTerminalCount(const byte *terminals, byte *groups);
-static byte AirportTestFTA(uint nofelements, const AirportFTA *layout, const byte *terminals);
+static byte AirportTestFTA(uint nof_elements, const AirportFTA *layout, const byte *terminals);
 
 #ifdef DEBUG_AIRPORT
-static void AirportPrintOut(uint nofelements, const AirportFTA *layout, bool full_report);
+static void AirportPrintOut(uint nof_elements, const AirportFTA *layout, bool full_report);
 #endif
 
 
-AirportFTAClass::AirportFTAClass(
-	AirportMovingData *moving_data_,
-	byte *terminals_,
-	byte *helipads_,
-	byte *entry_points_,
-	Flags flags_,
-	AirportFTAbuildup *apFA,
-	TileIndexDiffC *depots_,
-	byte nof_depots_,
-	uint size_x_,
-	uint size_y_,
-	byte delta_z_,
-	byte catchment_
-) :
-	moving_data(moving_data_),
-	terminals(terminals_),
-	helipads(helipads_),
-	airport_depots(depots_),
-	flags(flags_),
-	nof_depots(nof_depots_),
-	nofelements(AirportGetNofElements(apFA)),
-	entry_points(entry_points_),
-	size_x(size_x_),
-	size_y(size_y_),
-	delta_z(delta_z_),
-	catchment(catchment_)
-{
-	byte nofterminalgroups, nofhelipadgroups;
-
-
-	/* Set up the terminal and helipad count for an airport.
-	 * TODO: If there are more than 10 terminals or 4 helipads, internal variables
-	 * need to be changed, so don't allow that for now */
-	uint nofterminals = AirportGetTerminalCount(terminals, &nofterminalgroups);
-	if (nofterminals > MAX_TERMINALS) {
-		DEBUG(misc, 0, "[Ap] only a maximum of %d terminals are supported (requested %d)", MAX_TERMINALS, nofterminals);
-		assert(nofterminals <= MAX_TERMINALS);
-	}
-
-	uint nofhelipads = AirportGetTerminalCount(helipads, &nofhelipadgroups);
-	if (nofhelipads > MAX_HELIPADS) {
-		DEBUG(misc, 0, "[Ap] only a maximum of %d helipads are supported (requested %d)", MAX_HELIPADS, nofhelipads);
-		assert(nofhelipads <= MAX_HELIPADS);
-	}
-
-	/* Get the number of elements from the source table. We also double check this
-	 * with the entry point which must be within bounds and use this information
-	 * later on to build and validate the state machine */
-	for (DiagDirection i = DIAGDIR_BEGIN; i < DIAGDIR_END; i++) {
-		if (entry_points[i] >= nofelements) {
-			DEBUG(misc, 0, "[Ap] entry (%d) must be within the airport (maximum %d)", entry_points[i], nofelements);
-			assert(entry_points[i] < nofelements);
-		}
-	}
-
-	/* Build the state machine itself */
-	layout = AirportBuildAutomata(nofelements, apFA);
-	DEBUG(misc, 2, "[Ap] #count %3d; #term %2d (%dgrp); #helipad %2d (%dgrp); entries %3d, %3d, %3d, %3d",
-		nofelements, nofterminals, nofterminalgroups, nofhelipads, nofhelipadgroups,
-		entry_points[DIAGDIR_NE], entry_points[DIAGDIR_SE], entry_points[DIAGDIR_SW], entry_points[DIAGDIR_NW]);
-
-	/* Test if everything went allright. This is only a rude static test checking
-	 * the symantic correctness. By no means does passing the test mean that the
-	 * airport is working correctly or will not deadlock for example */
-	uint ret = AirportTestFTA(nofelements, layout, terminals);
-	if (ret != MAX_ELEMENTS) DEBUG(misc, 0, "[Ap] problem with element: %d", ret - 1);
-
-
-	//TODO: validation error disabled, as new airports will need a new validation system
-	//assert(ret == MAX_ELEMENTS);
-
-#ifdef DEBUG_AIRPORT
-	AirportPrintOut(nofelements, layout, DEBUG_AIRPORT);
-#endif
-}
-
-
 AirportFTAClass::~AirportFTAClass()
 {
-	for (uint i = 0; i < nofelements; i++) {
+	for (uint i = 0; i < nof_elements; i++) {
 		AirportFTA *current = layout[i].next;
 		while (current != NULL) {
 			AirportFTA *next = current->next;
@@ -120,84 +40,11 @@
 	free(layout);
 }
 
-/** Get the number of elements of a source Airport state automata
- * Since it is actually just a big array of AirportFTA types, we only
- * know one element from the other by differing 'position' identifiers */
-static uint16 AirportGetNofElements(const AirportFTAbuildup *apFA)
-{
-	uint16 nofelements = 0;
-	int temp = apFA[0].position;
-
-	for (uint i = 0; i < MAX_ELEMENTS; i++) {
-		if (temp != apFA[i].position) {
-			nofelements++;
-			temp = apFA[i].position;
-		}
-		if (apFA[i].position == MAX_ELEMENTS) break;
-	}
-	return nofelements;
-}
-
-/* We calculate the terminal/helipod count based on the data passed to us
- * This data (terminals) contains an index as a first element as to how many
- * groups there are, and then the number of terminals for each group */
-static byte AirportGetTerminalCount(const byte *terminals, byte *groups)
-{
-	byte nof_terminals = 0;
-	*groups = 0;
-
-	if (terminals != NULL) {
-		uint i = terminals[0];
-		*groups = i;
-		while (i-- > 0) {
-			terminals++;
-			assert(*terminals != 0); // no empty groups please
-			nof_terminals += *terminals;
-		}
-	}
-	return nof_terminals;
-}
-
-
-static AirportFTA* AirportBuildAutomata(uint nofelements, const AirportFTAbuildup *apFA)
-{
-	AirportFTA *FAutomata = MallocT<AirportFTA>(nofelements);
-	uint16 internalcounter = 0;
-
-	for (uint i = 0; i < nofelements; i++) {
-		AirportFTA *current = &FAutomata[i];
-		current->position      = apFA[internalcounter].position;
-		current->heading       = apFA[internalcounter].heading;
-		byte blocknumber = GB(apFA[internalcounter].block,0,7);
-		current->reserveblock.Initialise(&blocknumber, 1);
-		current->next_position = apFA[internalcounter].next;
-
-		// outgoing nodes from the same position, create linked list
-		while (current->position == apFA[internalcounter + 1].position) {
-			AirportFTA *newNode = MallocT<AirportFTA>(1);
-
-			newNode->position      = apFA[internalcounter + 1].position;
-			newNode->heading       = apFA[internalcounter + 1].heading;
-			byte blocknumber = GB(apFA[internalcounter].block,0,7);
-			newNode->reserveblock.Initialise(&blocknumber, 1);
-			newNode->next_position = apFA[internalcounter + 1].next;
-			// create link
-			current->next = newNode;
-			current = current->next;
-			internalcounter++;
-		}
-		current->next = NULL;
-		internalcounter++;
-	}
-	return FAutomata;
-}
-
-
-static byte AirportTestFTA(uint nofelements, const AirportFTA *layout, const byte *terminals)
+static byte AirportTestFTA(uint nof_elements, const AirportFTA *layout, const byte *terminals)
 {
 	uint next_position = 0;
 
-	for (uint i = 0; i < nofelements; i++) {
+	for (uint i = 0; i < nof_elements; i++) {
 		uint position = layout[i].position;
 		if (position != next_position) return i;
 		const AirportFTA *first = &layout[i];
@@ -217,7 +64,7 @@
 			/* Obviously the elements of the linked list must have the same identifier */
 			if (position != current->position) return i;
 			/* A next position must be within bounds */
-			if (current->next_position >= nofelements) return i;
+			if (current->next_position >= nof_elements) return i;
 		}
 		next_position++;
 	}
@@ -264,11 +111,11 @@
 }
 
 
-static void AirportPrintOut(uint nofelements, const AirportFTA *layout, bool full_report)
+static void AirportPrintOut(uint nof_elements, const AirportFTA *layout, bool full_report)
 {
 	if (!full_report) printf("(P = Current Position; NP = Next Position)\n");
 
-	for (uint i = 0; i < nofelements; i++) {
+	for (uint i = 0; i < nof_elements; i++) {
 		for (const AirportFTA *current = &layout[i]; current != NULL; current = current->next) {
 			if (full_report) {
 				byte heading = (current->heading == 255) ? MAX_HEADINGS + 1 : current->heading;
--- a/src/airport.h	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/airport.h	Tue Aug 21 09:02:06 2007 +0000
@@ -5,10 +5,12 @@
 #ifndef AIRPORT_H
 #define AIRPORT_H
 
-#include "direction.h"
-#include "fsmblockmap.h"
+#include "fsmport.h"
 #include <list>
 
+typedef FSMState AirportFTA;
+typedef FSMPortMovingData AirportMovingData;
+
 enum {MAX_TERMINALS =  36};
 enum {MAX_HELIPADS  =  24};
 enum {MAX_ELEMENTS  = 255};
@@ -69,83 +71,29 @@
 	FLYING         = 0x7F,
 };
 
-struct AirportMovingData {
-	int16 x;
-	int16 y;
-	int16 z;
-	uint16 flag;
-	DirectionByte direction;
-	byte state;
-	byte block;  //block number for this specific location
-};
-
-struct AirportFTAbuildup;
-
 // Finite sTate mAchine --> FTA
-struct AirportFTAClass {
-	public:
-		enum Flags {
-			AIRPLANES   = 0x1,
-			HELICOPTERS = 0x2,
-			ALL         = AIRPLANES | HELICOPTERS,
-			SHORT_STRIP = 0x4,
-			SEAPLANES   = 0x8
-		};
+struct AirportFTAClass : FSMPortClass {
+public:
+	enum Flags {
+		AIRPLANES   = 0x1,
+		HELICOPTERS = 0x2,
+		ALL         = AIRPLANES | HELICOPTERS,
+		SHORT_STRIP = 0x4,
+		SEAPLANES   = 0x8
+	};
 
-		AirportFTAClass(
-			AirportMovingData *moving_data,
-			byte *terminals,
-			byte *helipads,
-			byte *entry_points,
-			Flags flags,
-			AirportFTAbuildup *apFA,
-			TileIndexDiffC *depots,
-			byte nof_depots,
-			uint size_x,
-			uint size_y,
-			byte delta_z,
-			byte catchment
-		);
+	AirportFTAClass() : FSMPortClass(), terminals(NULL), helipads(NULL), flags((Flags)0), entry_points(NULL) {}
 
-		~AirportFTAClass();
+	~AirportFTAClass();
 
-		const AirportMovingData *MovingData(byte position) const
-		{
-			assert(position < nofelements);
-			return &moving_data[position];
-		}
-
-	AirportMovingData *moving_data;
-	struct AirportFTA *layout;            // state machine for airport
 	byte *terminals;
 	byte *helipads;
-	TileIndexDiffC *airport_depots; // gives the position of the depots on the airports
 	Flags flags;
-	byte nof_depots;                      // number of depots this airport has
-	byte nofelements;                     // number of positions the airport consists of
 	byte *entry_points;             ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction
-	byte size_x;
-	byte size_y;
-	byte delta_z;                         // Z adjustment for helicopter pads
-	byte catchment;
 };
 
 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
-	FSMblockmap reserveblock;       // 2 64 bit blocks
-	FSMblockmap releaseblock;       // 2 64 bit blocks
-	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
-	byte special;            // used as extra data for special orders 7B, 7C, 7D, 7E
-};
-
-void InitializeAirports();
-void UnInitializeAirports();
-
 /**
  * Get a list of currently available airports.
  * @return the list with available airports.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/fsmport.cpp	Tue Aug 21 09:02:06 2007 +0000
@@ -0,0 +1,20 @@
+/* $Id$ */
+
+/** @file airport.cpp */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "fsmport.h"
+
+FSMPortClass::~FSMPortClass()
+{
+	for (uint i = 0; i < nof_elements; i++) {
+		FSMState *current = layout[i].next;
+		while (current != NULL) {
+			FSMState *next = current->next;
+			free(current);
+			current = next;
+		};
+	}
+	free(layout);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/fsmport.h	Tue Aug 21 09:02:06 2007 +0000
@@ -0,0 +1,58 @@
+/* $Id$ */
+
+/** @file fsmport.h Various (base) declarations for FSM built ports */
+
+#ifndef FSMPORT_H
+#define FSMPORT_H
+
+#include "direction.h"
+#include "fsmblockmap.h"
+
+struct FSMPortMovingData {
+	int16 x;
+	int16 y;
+	int16 z;
+	uint16 flag;
+	Direction direction;
+	byte state;
+	byte block;  //block number for this specific location
+};
+
+struct FSMState {
+	FSMState *next;           ///< Possible extra movement choices from this position
+	FSMblockmap reserveblock; ///< The blocks to reserve at this state
+	FSMblockmap releaseblock; ///< The blocks to release at this state
+	byte position;            ///< The position that a vehicle is at
+	byte next_position;       ///< Next position from this position
+	byte heading;             ///< Heading (current orders), guiding a vehicle to its target on a port
+	byte special;             ///< Used as extra data for special orders 7B, 7C, 7D, 7E
+};
+
+
+struct FSMPortClass {
+public:
+	FSMPortClass() : moving_data(NULL), layout(NULL), nof_elements(0), depots(NULL),
+			nof_depots(0), size_x(0), size_y(0), delta_z(0), catchment(0) {}
+
+	~FSMPortClass();
+
+	const FSMPortMovingData *MovingData(byte position) const
+	{
+		assert(position < this->nof_elements);
+		return &this->moving_data[position];
+	}
+
+	FSMPortMovingData *moving_data;
+	FSMState *layout;
+	byte nof_elements;                     // number of positions the airport consists of
+
+	TileIndexDiffC *depots; // gives the position of the depots on the airports
+	byte nof_depots;                      // number of depots this airport has
+
+	byte size_x;
+	byte size_y;
+	byte delta_z;                         // Z adjustment for helicopter pads
+	byte catchment;
+};
+
+#endif /* FSMPORT_H */
--- a/src/newgrf.cpp	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/newgrf.cpp	Tue Aug 21 09:02:06 2007 +0000
@@ -2101,10 +2101,6 @@
 
 		switch (prop) {
 			case 0x08: { // Class ID
-				static AirportMovingData fsmport_moving_data_dummy[1] = {{ 0, 0, 0, 5, {DIR_N}, 0, 0 }};
-				static byte fsmport_entries_dummy[] = {0, 0, 0, 0};
-				static AirportFTAbuildup fsmport_fta_dummy[] = {{0, 0, 0, 0}, { MAX_ELEMENTS, 0, 0, 0 }};
-
 				FSMportsSpec **fsmportspec = &_cur_grffile->fsmports[stid + i];
 
 				/* Property 0x08 is special; it is where the station is allocated */
@@ -2115,18 +2111,7 @@
 				(*fsmportspec)->sclass = AllocateFSMportsClass(BSWAP32(classid));
 
 				/* create new AirportClass for this airport */
-				(*fsmportspec)->portFSM = new AirportFTAClass(		fsmport_moving_data_dummy,
-																	NULL,
-																	NULL,
-																	fsmport_entries_dummy,
-																	AirportFTAClass::ALL,
-																	fsmport_fta_dummy,
-																	NULL,
-																	0,
-																	0, 0,
-																	0,
-																	0
-																);
+				(*fsmportspec)->portFSM = new AirportFTAClass();
 
 			} break;
 
@@ -2265,12 +2250,12 @@
 				break;
 
 			case 0x1A: // Finite State Machine and Movement Orders
-				fsmportspec->portFSM->nofelements = grf_load_byte(&buf);
-				fsmportspec->portFSM->layout = MallocT<AirportFTA>(fsmportspec->portFSM->nofelements);
-				fsmportspec->portFSM->moving_data = MallocT<AirportMovingData>(fsmportspec->portFSM->nofelements);
+				fsmportspec->portFSM->nof_elements = grf_load_byte(&buf);
+				fsmportspec->portFSM->layout = MallocT<AirportFTA>(fsmportspec->portFSM->nof_elements);
+				fsmportspec->portFSM->moving_data = MallocT<AirportMovingData>(fsmportspec->portFSM->nof_elements);
 				fsmportspec->portFSM->size_x = fsmportspec->size_x[0];
 				fsmportspec->portFSM->size_y = fsmportspec->size_y[0];
-				for (byte element = 0; element < fsmportspec->portFSM->nofelements; element++) {
+				for (byte element = 0; element < fsmportspec->portFSM->nof_elements; element++) {
 					AirportMovingData md;
 					md.x = grf_load_word(&buf);
 					md.y = grf_load_word(&buf);
@@ -2325,13 +2310,13 @@
 
 			case 0x1D: // Hangar locations
 				fsmportspec->portFSM->nof_depots = grf_load_byte(&buf);
-				fsmportspec->portFSM->airport_depots = MallocT<TileIndexDiffC>(fsmportspec->portFSM->nof_depots);
+				fsmportspec->portFSM->depots = MallocT<TileIndexDiffC>(fsmportspec->portFSM->nof_depots);
 				for (uint depot = 0; depot < fsmportspec->portFSM->nof_depots; depot++) {
 					TileIndexDiffC depot_tile;
 					depot_tile.x = grf_load_byte(&buf);
 					depot_tile.y = grf_load_byte(&buf);
 					grf_load_byte(&buf);  //TODO: depot number. for the moment discard. will be used to allow multi-tile depots
-					fsmportspec->portFSM->airport_depots[depot] = depot_tile;
+					fsmportspec->portFSM->depots[depot] = depot_tile;
 				}
 				break;
 
--- a/src/newgrf_fsmports.h	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/newgrf_fsmports.h	Tue Aug 21 09:02:06 2007 +0000
@@ -22,13 +22,6 @@
 	FSMPORTS_CLASS_MAX = 32,     ///< Maximum number of classes.
 };
 
-struct AirportFTAbuildup {
-	byte position; // the position that an airplane is at
-	byte heading;  // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
-	uint64 block;  // the block this position is on on the airport (st->airport_flags)
-	byte next;     // next position from this position
-};
-
 /** Define basic enum properties */
 template <> struct EnumPropsT<FSMportsClassID> : MakeEnumPropsT<FSMportsClassID, byte, FSMPORTS_CLASS_BEGIN, FSMPORTS_CLASS_MAX, FSMPORTS_CLASS_MAX> {};
 typedef TinyEnumT<FSMportsClassID> FSMportsClassIDByte;
--- a/src/station_cmd.cpp	Mon Aug 20 23:21:45 2007 +0000
+++ b/src/station_cmd.cpp	Tue Aug 21 09:02:06 2007 +0000
@@ -62,10 +62,10 @@
 	TileIndexDiffC *hangar_list;
 	byte num_depots;
 	if (IsCustomFSMportsSpecIndex(t)) {
-		hangar_list = st->fsmportsspeclist[1].spec->portFSM->airport_depots;
+		hangar_list = st->fsmportsspeclist[1].spec->portFSM->depots;
 		num_depots = st->fsmportsspeclist[1].spec->portFSM->nof_depots;
 	} else {
-		hangar_list = st->Airport()->airport_depots;
+		hangar_list = st->Airport()->depots;
 		num_depots = st->Airport()->nof_depots;
 	}
 	for (uint i = 0; i < num_depots; i++) {
@@ -1762,7 +1762,7 @@
 	if (flags & DC_EXEC) {
 		for (uint i = 0; i < fsmportsspec->portFSM->nof_depots; ++i) {
 			DeleteWindowById(
-				WC_VEHICLE_DEPOT, tile + ToTileIndexDiff(fsmportsspec->portFSM->airport_depots[i])
+				WC_VEHICLE_DEPOT, tile + ToTileIndexDiff(fsmportsspec->portFSM->depots[i])
 			);
 		}