src/station_cmd.cpp
changeset 7320 96d5862ec06a
parent 7319 9b20d1dbe5d6
child 7333 e48228e44be8
--- a/src/station_cmd.cpp	Tue Jul 24 19:56:43 2007 +0000
+++ b/src/station_cmd.cpp	Tue Jul 24 21:48:50 2007 +0000
@@ -78,6 +78,26 @@
 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);