4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file depot_base.h Base for all depots (except hangars) */
15 #include "depot_type.h"
16 #include "town_type.h"
17 #include "map/coord.h"
18 #include "map/depot.h"
19 #include "depot_func.h"
20 #include "station_func.h"
21 #include "core/pool_type.hpp"
23 struct Depot
: PooledItem
<Depot
, DepotID
, 64, 64000> {
28 uint16 town_cn
; ///< The N-1th depot for this town (consecutive number)
29 Date build_date
; ///< Date of construction
31 Depot(TileIndex xy
= INVALID_TILE
) : xy(xy
) {}
34 static inline Depot
*GetByTile(TileIndex tile
)
36 return Depot::Get(GetDepotIndex(tile
));
40 * Is the "type" of depot the same as the given depot,
41 * i.e. are both a rail, road or ship depots?
42 * @param d The depot to compare to.
43 * @return true iff their types are equal.
45 inline bool IsOfType(const Depot
*d
) const
47 return GetTileType(d
->xy
) == GetTileType(this->xy
);
51 #define FOR_ALL_DEPOTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Depot, depot_index, var, start)
52 #define FOR_ALL_DEPOTS(var) FOR_ALL_DEPOTS_FROM(var, 0)
54 #endif /* DEPOT_BASE_H */