OpenTTD
depot_func.h
Go to the documentation of this file.
1 /* $Id: depot_func.h 23735 2012-01-03 20:26:05Z rubidium $ */
2 
3 /*
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/>.
8  */
9 
12 #ifndef DEPOT_FUNC_H
13 #define DEPOT_FUNC_H
14 
15 #include "vehicle_type.h"
16 #include "slope_func.h"
17 
18 void ShowDepotWindow(TileIndex tile, VehicleType type);
19 
21 
28 static inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
29 {
30  assert(tileh != SLOPE_FLAT);
31  Slope entrance_corners = InclinedSlope(direction);
32  /* For steep slopes both entrance corners must be raised (i.e. neither of them is the lowest corner),
33  * For non-steep slopes at least one corner must be raised. */
34  return IsSteepSlope(tileh) ? (tileh & entrance_corners) == entrance_corners : (tileh & entrance_corners) != 0;
35 }
36 
37 #endif /* DEPOT_FUNC_H */
Vehicle data structure.
Definition: vehicle_base.h:212
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Definition: slope_func.h:38
a flat tile
Definition: slope_type.h:51
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
Functions related to slopes.
void DeleteDepotHighlightOfVehicle(const Vehicle *v)
Removes the highlight of a vehicle in a depot window.
Definition: depot_gui.cpp:1112
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
Definition: depot_gui.cpp:1092
DiagDirection
Enumeration for diagonal directions.
static Slope InclinedSlope(DiagDirection dir)
Returns the slope that is inclined in a specific direction.
Definition: slope_func.h:258
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:28
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
Types related to vehicles.
Slope
Enumeration for the slope-type.
Definition: slope_type.h:50