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_map.h Map related accessors for depots. */
15 #include "station_map.h"
18 * Check if a tile is a depot and it is a depot of the given type.
20 static inline bool IsDepotTypeTile(TileIndex tile
, TransportType type
)
23 default: NOT_REACHED();
25 return IsRailDepotTile(tile
);
28 return IsRoadDepotTile(tile
);
31 return IsShipDepotTile(tile
);
36 * Is the given tile a tile with a depot on it?
37 * @param tile the tile to check
38 * @return true if and only if there is a depot on the tile.
40 static inline bool IsDepotTile(TileIndex tile
)
42 return IsRailDepotTile(tile
) || IsRoadDepotTile(tile
) || IsShipDepotTile(tile
) || IsHangarTile(tile
);
46 * Get the index of which depot is attached to the tile.
48 * @pre IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t)
51 static inline DepotID
GetDepotIndex(TileIndex t
)
53 /* Hangars don't have a Depot class, thus store no DepotID. */
54 assert(IsRailDepotTile(t
) || IsRoadDepotTile(t
) || IsShipDepotTile(t
));
58 #endif /* DEPOT_MAP_H */