summaryrefslogtreecommitdiff
path: root/src/depot_base.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-12 19:21:00 +0000
committerrubidium <rubidium@openttd.org>2010-05-12 19:21:00 +0000
commit93ff7d78e17ca68684065924942e40a355b58670 (patch)
tree2b363403e4e6b54d778ab55d78c2f15c27df8141 /src/depot_base.h
parent863ff6522b671ce69a1265fe246149b25e83a847 (diff)
downloadopenttd-93ff7d78e17ca68684065924942e40a355b58670.tar.xz
(svn r19799) -Change: give depots an unique name in the same manner buoys and waypoints are named
Diffstat (limited to 'src/depot_base.h')
-rw-r--r--src/depot_base.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/depot_base.h b/src/depot_base.h
index 82d78eb60..8a7305088 100644
--- a/src/depot_base.h
+++ b/src/depot_base.h
@@ -19,8 +19,11 @@ typedef Pool<Depot, DepotID, 64, 64000> DepotPool;
extern DepotPool _depot_pool;
struct Depot : DepotPool::PoolItem<&_depot_pool> {
+ Town *town;
+ const char *name;
+
TileIndex xy;
- TownID town_index;
+ uint16 town_cn; ///< The Nth depot for this town (consecutive number)
Depot(TileIndex xy = INVALID_TILE) : xy(xy) {}
~Depot();
@@ -29,6 +32,17 @@ struct Depot : DepotPool::PoolItem<&_depot_pool> {
{
return Depot::Get(GetDepotIndex(tile));
}
+
+ /**
+ * Is the "type" of depot the same as the given depot,
+ * i.e. are both a rail, road or ship depots?
+ * @param d The depot to compare to.
+ * @return true iff their types are equal.
+ */
+ FORCEINLINE bool IsOfType(const Depot *d) const
+ {
+ return GetTileType(d->xy) == GetTileType(this->xy);
+ }
};
#define FOR_ALL_DEPOTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Depot, depot_index, var, start)