2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
8 /** @file depot_base.h Base for all depots (except hangars) */
13 #include "depot_map.h"
14 #include "core/pool_type.hpp"
15 #include "timer/timer_game_calendar.h"
17 typedef Pool
<Depot
, DepotID
, 64, 64000> DepotPool
;
18 extern DepotPool _depot_pool
;
20 struct Depot
: DepotPool::PoolItem
<&_depot_pool
> {
21 /* DepotID index member of DepotPool is 2 bytes. */
22 uint16_t town_cn
; ///< The N-1th depot for this town (consecutive number)
26 TimerGameCalendar::Date build_date
; ///< Date of construction
28 Depot(TileIndex xy
= INVALID_TILE
) : xy(xy
) {}
31 static inline Depot
*GetByTile(TileIndex tile
)
33 return Depot::Get(GetDepotIndex(tile
));
37 * Is the "type" of depot the same as the given depot,
38 * i.e. are both a rail, road or ship depots?
39 * @param d The depot to compare to.
40 * @return true iff their types are equal.
42 inline bool IsOfType(const Depot
*d
) const
44 return GetTileType(d
->xy
) == GetTileType(this->xy
);
48 #endif /* DEPOT_BASE_H */