changeset 15803:969ab3547bd5 draft

(svn r20478) -Codechange: remove support for 'helipad groups' because there are no airports with more than 1 helipad group
author yexo <yexo@openttd.org>
date Fri, 13 Aug 2010 00:36:12 +0000
parents c0e7e98fe4b7
children cefe74c2f556
files src/aircraft_cmd.cpp src/airport.cpp src/airport.h src/table/airport_movement.h
diffstat 4 files changed, 24 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1431,7 +1431,7 @@
 		/* on an airport with helipads, a helicopter will always land there
 		 * and get serviced at the same time - setting */
 		if (_settings_game.order.serviceathelipad) {
-			if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) {
+			if (v->subtype == AIR_HELICOPTER && apc->num_helipads > 0) {
 				/* an exerpt of ServiceAircraft, without the invisibility stuff */
 				v->date_of_last_service = _date;
 				v->breakdowns_since_last_service = 0;
@@ -1869,12 +1869,11 @@
 static bool AirportFindFreeHelipad(Aircraft *v, const AirportFTAClass *apc)
 {
 	/* if an airport doesn't have helipads, use terminals */
-	if (apc->helipads == NULL) return AirportFindFreeTerminal(v, apc);
+	if (apc->num_helipads == 0) return AirportFindFreeTerminal(v, apc);
 
-	assert(apc->helipads[0] == 1);
 	/* only 1 helicoptergroup, check all helipads
 	 * The blocks for helipads start after the last terminal (MAX_TERMINALS) */
-	return FreeTerminal(v, MAX_TERMINALS, apc->helipads[1] + MAX_TERMINALS);
+	return FreeTerminal(v, MAX_TERMINALS, apc->num_helipads + MAX_TERMINALS);
 }
 
 static bool AircraftEventHandler(Aircraft *v, int loop)
--- a/src/airport.cpp
+++ b/src/airport.cpp
@@ -32,7 +32,7 @@
 static AirportFTAClass _airportfta_dummy(
 		_airport_moving_data_dummy,
 		NULL,
-		NULL,
+		0,
 		_airport_entries_dummy,
 		AirportFTAClass::ALL,
 		_airport_fta_dummy,
@@ -42,7 +42,7 @@
 static AirportFTAClass _airportfta_country(
 		_airport_moving_data_country,
 		_airport_terminal_country,
-		NULL,
+		0,
 		_airport_entries_country,
 		AirportFTAClass::ALL | AirportFTAClass::SHORT_STRIP,
 		_airport_fta_country,
@@ -52,7 +52,7 @@
 static AirportFTAClass _airportfta_city(
 		_airport_moving_data_town,
 		_airport_terminal_city,
-		NULL,
+		0,
 		_airport_entries_city,
 		AirportFTAClass::ALL,
 		_airport_fta_city,
@@ -62,7 +62,7 @@
 static AirportFTAClass _airportfta_oilrig(
 		_airport_moving_data_oilrig,
 		NULL,
-		_airport_helipad_heliport_oilrig,
+		1,
 		_airport_entries_heliport_oilrig,
 		AirportFTAClass::HELICOPTERS,
 		_airport_fta_heliport_oilrig,
@@ -72,7 +72,7 @@
 static AirportFTAClass _airportfta_heliport(
 		_airport_moving_data_heliport,
 		NULL,
-		_airport_helipad_heliport_oilrig,
+		1,
 		_airport_entries_heliport_oilrig,
 		AirportFTAClass::HELICOPTERS,
 		_airport_fta_heliport_oilrig,
@@ -82,7 +82,7 @@
 static AirportFTAClass _airportfta_metropolitan(
 		_airport_moving_data_metropolitan,
 		_airport_terminal_metropolitan,
-		NULL,
+		0,
 		_airport_entries_metropolitan,
 		AirportFTAClass::ALL,
 		_airport_fta_metropolitan,
@@ -92,7 +92,7 @@
 static AirportFTAClass _airportfta_international(
 		_airport_moving_data_international,
 		_airport_terminal_international,
-		_airport_helipad_international,
+		2,
 		_airport_entries_international,
 		AirportFTAClass::ALL,
 		_airport_fta_international,
@@ -102,7 +102,7 @@
 static AirportFTAClass _airportfta_commuter(
 		_airport_moving_data_commuter,
 		_airport_terminal_commuter,
-		_airport_helipad_commuter,
+		2,
 		_airport_entries_commuter,
 		AirportFTAClass::ALL | AirportFTAClass::SHORT_STRIP,
 		_airport_fta_commuter,
@@ -112,7 +112,7 @@
 static AirportFTAClass _airportfta_helidepot(
 		_airport_moving_data_helidepot,
 		NULL,
-		_airport_helipad_helidepot,
+		1,
 		_airport_entries_helidepot,
 		AirportFTAClass::HELICOPTERS,
 		_airport_fta_helidepot,
@@ -122,7 +122,7 @@
 static AirportFTAClass _airportfta_intercontinental(
 		_airport_moving_data_intercontinental,
 		_airport_terminal_intercontinental,
-		_airport_helipad_intercontinental,
+		2,
 		_airport_entries_intercontinental,
 		AirportFTAClass::ALL,
 		_airport_fta_intercontinental,
@@ -132,7 +132,7 @@
 static AirportFTAClass _airportfta_helistation(
 		_airport_moving_data_helistation,
 		NULL,
-		_airport_helipad_helistation,
+		3,
 		_airport_entries_helistation,
 		AirportFTAClass::HELICOPTERS,
 		_airport_fta_helistation,
@@ -191,7 +191,7 @@
 AirportFTAClass::AirportFTAClass(
 	const AirportMovingData *moving_data_,
 	const byte *terminals_,
-	const byte *helipads_,
+	const byte num_helipads_,
 	const byte *entry_points_,
 	Flags flags_,
 	const AirportFTAbuildup *apFA,
@@ -199,13 +199,13 @@
 ) :
 	moving_data(moving_data_),
 	terminals(terminals_),
-	helipads(helipads_),
+	num_helipads(num_helipads_),
 	flags(flags_),
 	nofelements(AirportGetNofElements(apFA)),
 	entry_points(entry_points_),
 	delta_z(delta_z_)
 {
-	byte nofterminalgroups, nofhelipadgroups;
+	byte nofterminalgroups;
 
 	/* Set up the terminal and helipad count for an airport.
 	 * TODO: If there are more than 10 terminals or 4 helipads, internal variables
@@ -216,10 +216,9 @@
 		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);
+	if (num_helipads > MAX_HELIPADS) {
+		DEBUG(misc, 0, "[Ap] only a maximum of %d helipads are supported (requested %d)", MAX_HELIPADS, num_helipads);
+		assert(num_helipads <= MAX_HELIPADS);
 	}
 
 	/* Get the number of elements from the source table. We also double check this
@@ -234,8 +233,8 @@
 
 	/* Build the state machine itself */
 	layout = AirportBuildAutomata(nofelements, apFA);
-	DEBUG(misc, 6, "[Ap] #count %3d; #term %2d (%dgrp); #helipad %2d (%dgrp); entries %3d, %3d, %3d, %3d",
-		nofelements, nofterminals, nofterminalgroups, nofhelipads, nofhelipadgroups,
+	DEBUG(misc, 6, "[Ap] #count %3d; #term %2d (%dgrp); #helipad %2d; entries %3d, %3d, %3d, %3d",
+		nofelements, nofterminals, nofterminalgroups, num_helipads,
 		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
--- a/src/airport.h
+++ b/src/airport.h
@@ -150,7 +150,7 @@
 	AirportFTAClass(
 		const AirportMovingData *moving_data,
 		const byte *terminals,
-		const byte *helipads,
+		const byte num_helipads,
 		const byte *entry_points,
 		Flags flags,
 		const AirportFTAbuildup *apFA,
@@ -168,7 +168,7 @@
 	const AirportMovingData *moving_data;
 	struct AirportFTA *layout;            ///< state machine for airport
 	const byte *terminals;
-	const byte *helipads;
+	const byte num_helipads;              ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals.
 	Flags flags;
 	byte nofelements;                     ///< number of positions the airport consists of
 	const byte *entry_points;             ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction
--- a/src/table/airport_movement.h
+++ b/src/table/airport_movement.h
@@ -441,7 +441,6 @@
 
 static const HangarTileTable _airport_depots_commuter[] = { {{4, 0}, 0} };
 static const byte _airport_terminal_commuter[] = { 1, 3 };
-static const byte _airport_helipad_commuter[] = { 1, 2 };
 static const byte _airport_entries_commuter[] = {22, 21, 24, 23};
 static const AirportFTAbuildup _airport_fta_commuter[] = {
 	{  0, HANGAR, NOTHING_block, 1 }, { 0, HELITAKEOFF, HELIPAD2_block, 1 }, { 0, 0, 0, 1 },
@@ -572,7 +571,6 @@
 
 static const HangarTileTable _airport_depots_international[] = { {{0, 3}, 0}, {{6, 1}, 1} };
 static const byte _airport_terminal_international[] = { 2, 3, 3 };
-static const byte _airport_helipad_international[] = { 1, 2 };
 static const byte _airport_entries_international[] = { 38, 37, 40, 39 };
 static const AirportFTAbuildup _airport_fta_international[] = {
 	{  0, HANGAR, NOTHING_block, 2 }, { 0, 255, TERM_GROUP1_block, 0 }, { 0, 255, TERM_GROUP2_ENTER1_block, 1 }, { 0, HELITAKEOFF, HELIPAD1_block, 2 }, { 0, 0, 0, 2 },
@@ -638,7 +636,6 @@
 /* intercontinental */
 static const HangarTileTable _airport_depots_intercontinental[] = { {{0, 5}, 0}, {{8, 4}, 1} };
 static const byte _airport_terminal_intercontinental[] = { 2, 4, 4 };
-static const byte _airport_helipad_intercontinental[] = { 1, 2 };
 static const byte _airport_entries_intercontinental[] = { 44, 43, 46, 45 };
 static const AirportFTAbuildup _airport_fta_intercontinental[] = {
 	{  0, HANGAR, NOTHING_block, 2 }, { 0, 255, HANGAR1_AREA_block | TERM_GROUP1_block, 0 }, { 0, 255, HANGAR1_AREA_block | TERM_GROUP1_block, 1 }, { 0, TAKEOFF, HANGAR1_AREA_block | TERM_GROUP1_block, 2 }, { 0, 0, 0, 2 },
@@ -731,7 +728,6 @@
 
 
 /* heliports, oilrigs don't have depots */
-static const byte _airport_helipad_heliport_oilrig[] = { 1, 1 };
 static const byte _airport_entries_heliport_oilrig[] = { 7, 7, 7, 7 };
 static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
 	{ 0, HELIPAD1, HELIPAD1_block, 1 },
@@ -749,7 +745,6 @@
 
 /* helidepots */
 static const HangarTileTable _airport_depots_helidepot[] = { {{1, 0}, 0} };
-static const byte _airport_helipad_helidepot[] = { 1, 1 };
 static const byte _airport_entries_helidepot[] = { 4, 4, 4, 4 };
 static const AirportFTAbuildup _airport_fta_helidepot[] = {
 	{  0, HANGAR, NOTHING_block, 1 },
@@ -779,7 +774,6 @@
 
 /* helistation */
 static const HangarTileTable _airport_depots_helistation[] = { {{0, 0}, 0} };
-static const byte _airport_helipad_helistation[] = { 1, 3 };
 static const byte _airport_entries_helistation[] = { 25, 25, 25, 25 };
 static const AirportFTAbuildup _airport_fta_helistation[] = {
 	{  0, HANGAR, NOTHING_block, 8 },    { 0, HELIPAD1, 0, 1 }, { 0, HELIPAD2, 0, 1 }, { 0, HELIPAD3, 0, 1 }, { 0, HELITAKEOFF, 0, 1 }, { 0, 0, 0, 0 },