depot_base.h

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef DEPOT_BASE_H
00013 #define DEPOT_BASE_H
00014 
00015 #include "depot_map.h"
00016 #include "core/pool_type.hpp"
00017 
00018 typedef Pool<Depot, DepotID, 64, 64000> DepotPool;
00019 extern DepotPool _depot_pool;
00020 
00021 struct Depot : DepotPool::PoolItem<&_depot_pool> {
00022   Town *town;
00023   char *name;
00024 
00025   TileIndex xy;
00026   uint16 town_cn;    
00027   Date build_date;   
00028 
00029   Depot(TileIndex xy = INVALID_TILE) : xy(xy) {}
00030   ~Depot();
00031 
00032   static FORCEINLINE Depot *GetByTile(TileIndex tile)
00033   {
00034     return Depot::Get(GetDepotIndex(tile));
00035   }
00036 
00043   FORCEINLINE bool IsOfType(const Depot *d) const
00044   {
00045     return GetTileType(d->xy) == GetTileType(this->xy);
00046   }
00047 };
00048 
00049 #define FOR_ALL_DEPOTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Depot, depot_index, var, start)
00050 #define FOR_ALL_DEPOTS(var) FOR_ALL_DEPOTS_FROM(var, 0)
00051 
00052 #endif /* DEPOT_BASE_H */

Generated on Mon May 9 05:18:52 2011 for OpenTTD by  doxygen 1.6.1