summaryrefslogtreecommitdiff
path: root/src/newgrf_airport.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-03-05 23:21:30 +0000
committeryexo <yexo@openttd.org>2010-03-05 23:21:30 +0000
commitd03d990f33d9224295e90a1111394206a7cbfd42 (patch)
tree01a8691395273e77b0400d16ad6fe6885b2206fd /src/newgrf_airport.cpp
parent664934e6f6c24aa63b0bd3b3e4a0333eab53d612 (diff)
downloadopenttd-d03d990f33d9224295e90a1111394206a7cbfd42.tar.xz
(svn r19324) -Codechange: introduce AirportSpec::GetWithoutOverride to get a non-const pointer to a given airportspec
Diffstat (limited to 'src/newgrf_airport.cpp')
-rw-r--r--src/newgrf_airport.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp
index c5bc5eb55..20c0ba0e7 100644
--- a/src/newgrf_airport.cpp
+++ b/src/newgrf_airport.cpp
@@ -21,7 +21,8 @@ AirportSpec AirportSpec::oilrig = {NULL, NULL, 0, 1, 1, 0, 4, MIN_YEAR, MIN_YEAR
AirportSpec AirportSpec::specs[NUM_AIRPORTS];
/**
- * Retrieve airport spec for the given airport
+ * Retrieve airport spec for the given airport. If an override is available
+ * it is returned.
* @param type index of airport
* @return A pointer to the corresponding AirportSpec
*/
@@ -32,6 +33,19 @@ AirportSpec AirportSpec::specs[NUM_AIRPORTS];
return &AirportSpec::specs[type];
}
+/**
+ * Retrieve airport spec for the given airport. Even if an override is
+ * available the base spec is returned.
+ * @param type index of airport
+ * @return A pointer to the corresponding AirportSpec
+ */
+/* static */ AirportSpec *AirportSpec::GetWithoutOverride(byte type)
+{
+ if (type == AT_OILRIG) return &oilrig;
+ assert(type < lengthof(AirportSpec::specs));
+ return &AirportSpec::specs[type];
+}
+
bool AirportSpec::IsAvailable() const
{
if (_cur_year < this->min_year) return false;