summaryrefslogtreecommitdiff
path: root/src/airport_gui.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-06-21 13:26:30 +0000
committeryexo <yexo@openttd.org>2009-06-21 13:26:30 +0000
commitc7bd6c8d3460e6da19e38b230be7b456d31e1df8 (patch)
treea4878c0e6922e333990b3a767d74a83777883ba6 /src/airport_gui.cpp
parent548a605263f7764602d6ee7fc9ca3856bf00918b (diff)
downloadopenttd-c7bd6c8d3460e6da19e38b230be7b456d31e1df8.tar.xz
(svn r16614) -Codechange: Make the airport min/max available year a property of the Airport class.
-Change: rename station.always_small_airport to station.never_expire_airports to make it more future-proof
Diffstat (limited to 'src/airport_gui.cpp')
-rw-r--r--src/airport_gui.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 539ade2ff..fa1389202 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -224,23 +224,14 @@ public:
{
int i; // airport enabling loop
uint16 y_noise_offset = 0;
- uint32 avail_airports;
const AirportFTAClass *airport;
- avail_airports = GetValidAirports();
-
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
- if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
- if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
+ if (!GetAirport(AT_SMALL)->IsAvailable() && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
+ if (!GetAirport(AT_LARGE)->IsAvailable() && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
- /* 'Country Airport' starts at widget BAW_SMALL_AIRPORT, and if its bit is set, it is
- * available, so take its opposite value to set the disabled state.
- * There are 9 buildable airports
- * XXX TODO : all airports should be held in arrays, with all relevant data.
- * This should be part of newgrf-airports, i suppose
- */
- for (i = 0; i < BAW_AIRPORT_COUNT; i++) this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !HasBit(avail_airports, i));
+ for (i = 0; i < BAW_AIRPORT_COUNT; i++) this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !GetAirport(i)->IsAvailable());
/* select default the coverage area to 'Off' (16) */
airport = GetAirport(_selected_airport_type);