summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-24 21:48:50 +0000
committerrubidium <rubidium@openttd.org>2007-07-24 21:48:50 +0000
commite640900e8ac5e35dad2242bda391903a04906852 (patch)
treed06ccafbe3bf6b917dc22e2b1c2d253b231b0e58 /src/station_cmd.cpp
parentfe8e2979954ed2e129af7a23ec76c6aea73c36da (diff)
downloadopenttd-e640900e8ac5e35dad2242bda391903a04906852.tar.xz
(svn r10681) -Codechange: do not determine whether a tile is a hangar based on the graphics index to be drawn on the given tile, but do it based on the specification of the location of hangars of the airport.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index df788d997..1c858c91a 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -78,6 +78,26 @@ DEFINE_OLD_POOL(Station, Station, StationPoolNewBlock, StationPoolCleanBlock)
DEFINE_OLD_POOL(RoadStop, RoadStop, RoadStopPoolNewBlock, NULL)
+/**
+ * Check whether the given tile is a hangar.
+ * @param t the tile to of whether it is a hangar.
+ * @pre IsTileType(t, MP_STATION)
+ * @return true if and only if the tile is a hangar.
+ */
+bool IsHangar(TileIndex t)
+{
+ assert(IsTileType(t, MP_STATION));
+
+ const Station *st = GetStationByTile(t);
+ const AirportFTAClass *apc = st->Airport();
+
+ for (uint i = 0; i < apc->nof_depots; i++) {
+ if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == t) return true;
+ }
+
+ return false;
+}
+
RoadStop* GetRoadStopByTile(TileIndex tile, RoadStop::Type type)
{
const Station* st = GetStationByTile(tile);