OpenTTD Source  1.11.2
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 
19 
26 static inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
27 {
28  assert(tileh != SLOPE_FLAT);
29  Slope entrance_corners = InclinedSlope(direction);
30  /* For steep slopes both entrance corners must be raised (i.e. neither of them is the lowest corner),
31  * For non-steep slopes at least one corner must be raised. */
32  return IsSteepSlope(tileh) ? (tileh & entrance_corners) == entrance_corners : (tileh & entrance_corners) != 0;
33 }
34 
35 #endif /* DEPOT_FUNC_H */
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
InclinedSlope
static Slope InclinedSlope(DiagDirection dir)
Returns the slope that is inclined in a specific direction.
Definition: slope_func.h:256
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:222
CanBuildDepotByTileh
static 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:26
SLOPE_FLAT
@ SLOPE_FLAT
a flat tile
Definition: slope_type.h:49
IsSteepSlope
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Definition: slope_func.h:36
slope_func.h
DeleteDepotHighlightOfVehicle
void DeleteDepotHighlightOfVehicle(const Vehicle *v)
Removes the highlight of a vehicle in a depot window.
Definition: depot_gui.cpp:1122
Slope
Slope
Enumeration for the slope-type.
Definition: slope_type.h:48
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:77
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
vehicle_type.h
ShowDepotWindow
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
Definition: depot_gui.cpp:1102