Fix #9521: Don't load at just removed docks that were part of a multi-dock station...
[openttd-github.git] / src / depot_base.h
blobf4c52cffe85a8b07883251babaf2d941ef76290e
1 /*
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/>.
6 */
8 /** @file depot_base.h Base for all depots (except hangars) */
10 #ifndef DEPOT_BASE_H
11 #define DEPOT_BASE_H
13 #include "depot_map.h"
14 #include "core/pool_type.hpp"
16 typedef Pool<Depot, DepotID, 64, 64000> DepotPool;
17 extern DepotPool _depot_pool;
19 struct Depot : DepotPool::PoolItem<&_depot_pool> {
20 Town *town;
21 std::string name;
23 TileIndex xy;
24 uint16 town_cn; ///< The N-1th depot for this town (consecutive number)
25 Date build_date; ///< Date of construction
27 Depot(TileIndex xy = INVALID_TILE) : xy(xy) {}
28 ~Depot();
30 static inline Depot *GetByTile(TileIndex tile)
32 return Depot::Get(GetDepotIndex(tile));
35 /**
36 * Is the "type" of depot the same as the given depot,
37 * i.e. are both a rail, road or ship depots?
38 * @param d The depot to compare to.
39 * @return true iff their types are equal.
41 inline bool IsOfType(const Depot *d) const
43 return GetTileType(d->xy) == GetTileType(this->xy);
47 #endif /* DEPOT_BASE_H */