Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / depot_base.h
blob1d8330fc740354d8c58f97dccf690a943a2e564c
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"
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)
23 TileIndex xy;
24 Town *town;
25 std::string name;
26 TimerGameCalendar::Date build_date; ///< Date of construction
28 Depot(TileIndex xy = INVALID_TILE) : xy(xy) {}
29 ~Depot();
31 static inline Depot *GetByTile(TileIndex tile)
33 return Depot::Get(GetDepotIndex(tile));
36 /**
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 */