depot_base.h

Go to the documentation of this file.
00001 /* $Id: depot_base.h 14807 2009-01-03 16:06:58Z smatz $ */
00002 
00005 #ifndef DEPOT_BASE_H
00006 #define DEPOT_BASE_H
00007 
00008 #include "tile_type.h"
00009 #include "depot_type.h"
00010 #include "oldpool.h"
00011 #include "town_type.h"
00012 
00013 DECLARE_OLD_POOL(Depot, Depot, 3, 8000)
00014 
00015 struct Depot : PoolItem<Depot, DepotID, &_Depot_pool> {
00016   TileIndex xy;
00017   TownID town_index;
00018 
00019   Depot(TileIndex xy = INVALID_TILE) : xy(xy) {}
00020   ~Depot();
00021 
00022   inline bool IsValid() const { return this->xy != INVALID_TILE; }
00023 };
00024 
00025 static inline bool IsValidDepotID(DepotID index)
00026 {
00027   return index < GetDepotPoolSize() && GetDepot(index)->IsValid();
00028 }
00029 
00030 Depot *GetDepotByTile(TileIndex tile);
00031 
00032 #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())
00033 #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
00034 
00035 #endif /* DEPOT_BASE_H */

Generated on Thu Sep 24 19:35:01 2009 for OpenTTD by  doxygen 1.5.6