summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-26 16:53:06 +0000
committerrubidium <rubidium@openttd.org>2010-08-26 16:53:06 +0000
commit82ef98a90a2579927df4479b63d3ad9f555d0057 (patch)
tree45fe6708a636470d8e883ca65c55aa46e41bb19e
parent9982b5fd00620345b3d905407acf6ad21ec5c6c9 (diff)
downloadopenttd-82ef98a90a2579927df4479b63d3ad9f555d0057.tar.xz
(svn r20625) -Add: AirportTileSpec::GetByTile to simplify accessing the AirportTileSpec
-rw-r--r--src/newgrf_airporttiles.cpp10
-rw-r--r--src/newgrf_airporttiles.h1
-rw-r--r--src/station_cmd.cpp2
3 files changed, 12 insertions, 1 deletions
diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp
index 9de3f38fd..22e739eed 100644
--- a/src/newgrf_airporttiles.cpp
+++ b/src/newgrf_airporttiles.cpp
@@ -48,6 +48,16 @@ AirportTileOverrideManager _airporttile_mngr(NEW_AIRPORTTILE_OFFSET, NUM_AIRPORT
}
/**
+ * Retrieve airport tile spec for the given airport tile.
+ * @param tile The airport tile.
+ * @return A pointer to the corresponding AirportTileSpec.
+ */
+/* static */ const AirportTileSpec *AirportTileSpec::GetByTile(TileIndex tile)
+{
+ return AirportTileSpec::Get(GetAirportGfx(tile));
+}
+
+/**
* This function initializes the tile array of AirportTileSpec
*/
void AirportTileSpec::ResetAirportTiles()
diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h
index 83c594024..61b0a2b1c 100644
--- a/src/newgrf_airporttiles.h
+++ b/src/newgrf_airporttiles.h
@@ -29,6 +29,7 @@ struct AirportTileSpec {
GRFFileProps grf_prop; ///< properties related the the grf file
static const AirportTileSpec *Get(StationGfx gfx);
+ static const AirportTileSpec *GetByTile(TileIndex tile);
static void ResetAirportTiles();
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 8d53487b7..a1b971527 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2807,7 +2807,7 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
}
if (IsAirport(tile)) {
- const AirportTileSpec *ats = AirportTileSpec::Get(GetAirportGfx(tile));
+ const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
td->airport_tile_name = ats->name;
if (ats->grf_prop.grffile != NULL) {