OpenTTD Source: src/depot_func.h Source File

OpenTTD Source 14.0-beta3

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
16 void ShowDepotWindow(TileIndex tile, VehicleType type);
17 void InitDepotWindowBlockSizes();
18
19 void DeleteDepotHighlightOfVehicle(const Vehicle *v);
20
27 inline 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 */
CanBuildDepotByTileh
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
IsSteepSlope
static constexpr bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Definition: slope_func.h:36
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:240
Slope
Slope
Enumeration for the slope-type.
Definition: slope_type.h:48
slope_func.h
DeleteDepotHighlightOfVehicle
void DeleteDepotHighlightOfVehicle(const Vehicle *v)
Removes the highlight of a vehicle in a depot window.
Definition: depot_gui.cpp:1161
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:73
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
vehicle_type.h
InitDepotWindowBlockSizes
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...
Definition: depot_gui.cpp:218
InclinedSlope
Slope InclinedSlope(DiagDirection dir)
Returns the slope that is inclined in a specific direction.
Definition: slope_func.h:256
SLOPE_FLAT
@ SLOPE_FLAT
a flat tile
Definition: slope_type.h:49
ShowDepotWindow
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
Definition: depot_gui.cpp:1141