summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-08-13 00:36:12 +0000
committeryexo <yexo@openttd.org>2010-08-13 00:36:12 +0000
commitbc96bdb203a74a661a0365d998069cc939a4c06e (patch)
tree205664ab6b4caf90f3cd3d977ccd1e1e00dcb9a5
parente4117dbfb7c940180eb8aab7f9d0a726364078ab (diff)
downloadopenttd-bc96bdb203a74a661a0365d998069cc939a4c06e.tar.xz
(svn r20478) -Codechange: remove support for 'helipad groups' because there are no airports with more than 1 helipad group
-rw-r--r--src/aircraft_cmd.cpp7
-rw-r--r--src/airport.cpp39
-rw-r--r--src/airport.h4
-rw-r--r--src/table/airport_movement.h6
4 files changed, 24 insertions, 32 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 6dc0e05ee..c3ea73416 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1431,7 +1431,7 @@ static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass *
/* 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 AirportFindFreeTerminal(Aircraft *v, const AirportFTAClass *apc)
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)
diff --git a/src/airport.cpp b/src/airport.cpp
index bb4957681..0a2d046ce 100644
--- 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_dummy(
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_country(
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_city(
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_oilrig(
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_heliport(
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_metropolitan(
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_international(
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_commuter(
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_helidepot(
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_intercontinental(
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 @@ AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Directi
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 @@ AirportFTAClass::AirportFTAClass(
) :
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 @@ AirportFTAClass::AirportFTAClass(
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 @@ AirportFTAClass::AirportFTAClass(
/* 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
diff --git a/src/airport.h b/src/airport.h
index b96c0939f..5bea9b50d 100644
--- a/src/airport.h
+++ b/src/airport.h
@@ -150,7 +150,7 @@ public:
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 @@ public:
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
diff --git a/src/table/airport_movement.h b/src/table/airport_movement.h
index 0fffae2f2..9bc7fe8ac 100644
--- a/src/table/airport_movement.h
+++ b/src/table/airport_movement.h
@@ -441,7 +441,6 @@ static const AirportFTAbuildup _airport_fta_country[] = {
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 AirportFTAbuildup _airport_fta_metropolitan[] = {
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 @@ static const AirportFTAbuildup _airport_fta_international[] = {
/* 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 @@ static const AirportFTAbuildup _airport_fta_intercontinental[] = {
/* 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 @@ static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
/* 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 @@ static const AirportFTAbuildup _airport_fta_helidepot[] = {
/* 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 },