OpenTTD Source 20241224-master-gf74b0cf984
depot_func.h
Go to the documentation of this file.
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 */
7
10#ifndef DEPOT_FUNC_H
11#define DEPOT_FUNC_H
12
13#include "vehicle_type.h"
14#include "slope_func.h"
15
18
20
27inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
28{
29 assert(tileh != SLOPE_FLAT);
30 Slope entrance_corners = InclinedSlope(direction);
31 /* For steep slopes both entrance corners must be raised (i.e. neither of them is the lowest corner),
32 * For non-steep slopes at least one corner must be raised. */
33 return IsSteepSlope(tileh) ? (tileh & entrance_corners) == entrance_corners : (tileh & entrance_corners) != 0;
34}
35
36#endif /* DEPOT_FUNC_H */
void InitDepotWindowBlockSizes()
Set the size of the blocks in the window so we can be sure that they are big enough for the vehicle s...
bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
Definition depot_func.h:27
void DeleteDepotHighlightOfVehicle(const Vehicle *v)
Removes the highlight of a vehicle in a depot window.
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
DiagDirection
Enumeration for diagonal directions.
Functions related to slopes.
static constexpr bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Definition slope_func.h:36
Slope InclinedSlope(DiagDirection dir)
Returns the slope that is inclined in a specific direction.
Definition slope_func.h:256
Slope
Enumeration for the slope-type.
Definition slope_type.h:48
@ SLOPE_FLAT
a flat tile
Definition slope_type.h:49
Vehicle data structure.
Types related to vehicles.
VehicleType
Available vehicle types.