(svn r19799) -Change: give depots an unique name in the same manner buoys and waypoints are named

This commit is contained in:
rubidium
2010-05-12 19:21:00 +00:00
parent 92648be718
commit 7f43b93eae
11 changed files with 64 additions and 14 deletions

View File

@@ -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)