Mercurial > hg > openttd
view src/depot_base.h @ 9038:6e86ab2cba9f draft
(svn r12857) -Fix [FS#1948]: remove the last uses of AutoPtr in the station code.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 23 Apr 2008 22:16:41 +0000 |
parents | 322e2779f67a |
children | d48433370037 |
line wrap: on
line source
/* $Id$ */ /** @file depot.h Base for all depots (except hangars) */ #ifndef DEPOT_BASE_H #define DEPOT_BASE_H #include "tile_type.h" #include "depot_type.h" #include "oldpool.h" #include "town_type.h" DECLARE_OLD_POOL(Depot, Depot, 3, 8000) struct Depot : PoolItem<Depot, DepotID, &_Depot_pool> { TileIndex xy; TownID town_index; Depot(TileIndex xy = 0) : xy(xy) {} ~Depot(); inline bool IsValid() const { return this->xy != 0; } }; static inline bool IsValidDepotID(DepotID index) { return index < GetDepotPoolSize() && GetDepot(index)->IsValid(); } Depot *GetDepotByTile(TileIndex tile); #define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) if (d->IsValid()) #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0) #endif /* DEPOT_BASE_H */