summaryrefslogtreecommitdiff
path: root/src/depot_map.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-10 14:33:07 +0000
committerrubidium <rubidium@openttd.org>2009-09-10 14:33:07 +0000
commit55ddce8da2b6993fa1228a8935526d40fc44de46 (patch)
tree02f1f3836fd9c76b19b741a772d0efb29c528d7b /src/depot_map.h
parentbb94724a092750794e8c2ad1a6537fac6b902b9e (diff)
downloadopenttd-55ddce8da2b6993fa1228a8935526d40fc44de46.tar.xz
(svn r17493) -Codechange: store the depot index on the map
Diffstat (limited to 'src/depot_map.h')
-rw-r--r--src/depot_map.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/depot_map.h b/src/depot_map.h
index 4f34da34a..ecf2960e1 100644
--- a/src/depot_map.h
+++ b/src/depot_map.h
@@ -45,4 +45,17 @@ static inline bool IsDepotTile(TileIndex tile)
return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
}
+/**
+ * Get the index of which depot is attached to the tile.
+ * @param t the tile
+ * @pre IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t)
+ * @return DepotID
+ */
+static inline DepotID GetDepotIndex(TileIndex t)
+{
+ /* Hangars don't have a Depot class, thus store no DepotID. */
+ assert(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t));
+ return _m[t].m2;
+}
+
#endif /* DEPOT_MAP_H */