00001 /* $Id: depot_base.h 18809 2010-01-15 16:41:15Z rubidium $ */ 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 TileIndex xy; 00023 TownID town_index; 00024 00025 Depot(TileIndex xy = INVALID_TILE) : xy(xy) {} 00026 ~Depot(); 00027 00028 static FORCEINLINE Depot *GetByTile(TileIndex tile) 00029 { 00030 return Depot::Get(GetDepotIndex(tile)); 00031 } 00032 }; 00033 00034 #define FOR_ALL_DEPOTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Depot, depot_index, var, start) 00035 #define FOR_ALL_DEPOTS(var) FOR_ALL_DEPOTS_FROM(var, 0) 00036 00037 #endif /* DEPOT_BASE_H */