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 "tile_type.h" 00016 #include "depot_map.h" 00017 #include "core/pool_type.hpp" 00018 #include "town_type.h" 00019 00020 typedef Pool<Depot, DepotID, 64, 64000> DepotPool; 00021 extern DepotPool _depot_pool; 00022 00023 struct Depot : DepotPool::PoolItem<&_depot_pool> { 00024 TileIndex xy; 00025 TownID town_index; 00026 00027 Depot(TileIndex xy = INVALID_TILE) : xy(xy) {} 00028 ~Depot(); 00029 00030 static FORCEINLINE Depot *GetByTile(TileIndex tile) 00031 { 00032 return Depot::Get(GetDepotIndex(tile)); 00033 } 00034 }; 00035 00036 #define FOR_ALL_DEPOTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Depot, depot_index, var, start) 00037 #define FOR_ALL_DEPOTS(var) FOR_ALL_DEPOTS_FROM(var, 0) 00038 00039 #endif /* DEPOT_BASE_H */