OpenTTD Source  20241108-master-g80f628063a
slope_type.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 
14 #ifndef SLOPE_TYPE_H
15 #define SLOPE_TYPE_H
16 
17 #include "core/enum_type.hpp"
18 
22 enum Corner {
23  CORNER_W = 0,
24  CORNER_S = 1,
25  CORNER_E = 2,
26  CORNER_N = 3,
27  CORNER_END,
28  CORNER_INVALID = 0xFF
29 };
30 
31 
48 enum Slope : uint8_t {
49  SLOPE_FLAT = 0x00,
50  SLOPE_W = 0x01,
51  SLOPE_S = 0x02,
52  SLOPE_E = 0x04,
53  SLOPE_N = 0x08,
54  SLOPE_STEEP = 0x10,
70 
71  SLOPE_HALFTILE = 0x20,
73  SLOPE_HALFTILE_W = SLOPE_HALFTILE | (CORNER_W << 6),
74  SLOPE_HALFTILE_S = SLOPE_HALFTILE | (CORNER_S << 6),
75  SLOPE_HALFTILE_E = SLOPE_HALFTILE | (CORNER_E << 6),
76  SLOPE_HALFTILE_N = SLOPE_HALFTILE | (CORNER_N << 6),
77 };
79 
80 
84 #define M(x) (1U << (x))
87 #undef M
88 
89 
93 enum Foundation {
99 
100  /* Halftile foundations */
106 
107  /* Special anti-zig-zag foundations for single horizontal/vertical track */
112 
114 };
115 
116 #endif /* SLOPE_TYPE_H */
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Type (helpers) for enums.
Slope
Enumeration for the slope-type.
Definition: slope_type.h:48
@ SLOPE_HALFTILE_N
the north halftile is leveled (non continuous slope)
Definition: slope_type.h:76
@ SLOPE_W
the west corner of the tile is raised
Definition: slope_type.h:50
@ SLOPE_HALFTILE_MASK
three bits used for halftile slopes
Definition: slope_type.h:72
@ SLOPE_ELEVATED
bit mask containing all 'simple' slopes
Definition: slope_type.h:61
@ SLOPE_NS
north and south corner are raised
Definition: slope_type.h:60
@ SLOPE_E
the east corner of the tile is raised
Definition: slope_type.h:52
@ SLOPE_WSE
west, south and east corner are raised
Definition: slope_type.h:63
@ SLOPE_S
the south corner of the tile is raised
Definition: slope_type.h:51
@ SLOPE_N
the north corner of the tile is raised
Definition: slope_type.h:53
@ SLOPE_SEN
south, east and north corner are raised
Definition: slope_type.h:64
@ SLOPE_ENW
east, north and west corner are raised
Definition: slope_type.h:65
@ SLOPE_SW
south and west corner are raised
Definition: slope_type.h:56
@ SLOPE_FLAT
a flat tile
Definition: slope_type.h:49
@ SLOPE_STEEP_W
a steep slope falling to east (from west)
Definition: slope_type.h:66
@ SLOPE_HALFTILE_E
the east halftile is leveled (non continuous slope)
Definition: slope_type.h:75
@ SLOPE_NE
north and east corner are raised
Definition: slope_type.h:58
@ SLOPE_HALFTILE_S
the south halftile is leveled (non continuous slope)
Definition: slope_type.h:74
@ SLOPE_STEEP_E
a steep slope falling to west (from east)
Definition: slope_type.h:68
@ SLOPE_SE
south and east corner are raised
Definition: slope_type.h:57
@ SLOPE_HALFTILE_W
the west halftile is leveled (non continuous slope)
Definition: slope_type.h:73
@ SLOPE_NWS
north, west and south corner are raised
Definition: slope_type.h:62
@ SLOPE_NW
north and west corner are raised
Definition: slope_type.h:55
@ SLOPE_STEEP_N
a steep slope falling to south (from north)
Definition: slope_type.h:69
@ SLOPE_STEEP_S
a steep slope falling to north (from south)
Definition: slope_type.h:67
@ SLOPE_HALFTILE
one halftile is leveled (non continuous slope)
Definition: slope_type.h:71
@ SLOPE_EW
east and west corner are raised
Definition: slope_type.h:59
@ SLOPE_STEEP
indicates the slope is steep
Definition: slope_type.h:54
Foundation
Enumeration for Foundations.
Definition: slope_type.h:93
@ FOUNDATION_RAIL_W
Foundation for TRACK_BIT_LEFT, but not a leveled foundation.
Definition: slope_type.h:108
@ FOUNDATION_RAIL_N
Foundation for TRACK_BIT_UPPER, but not a leveled foundation.
Definition: slope_type.h:111
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
Definition: slope_type.h:95
@ FOUNDATION_RAIL_E
Foundation for TRACK_BIT_RIGHT, but not a leveled foundation.
Definition: slope_type.h:110
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
Definition: slope_type.h:94
@ FOUNDATION_INCLINED_X
The tile has an along X-axis inclined foundation.
Definition: slope_type.h:96
@ FOUNDATION_STEEP_BOTH
The tile has a steep slope. The lowest corner is raised by a foundation and the upper halftile is lev...
Definition: slope_type.h:101
@ FOUNDATION_RAIL_S
Foundation for TRACK_BIT_LOWER, but not a leveled foundation.
Definition: slope_type.h:109
@ FOUNDATION_INCLINED_Y
The tile has an along Y-axis inclined foundation.
Definition: slope_type.h:97
@ FOUNDATION_STEEP_LOWER
The tile has a steep slope. The lowest corner is raised by a foundation to allow building railroad on...
Definition: slope_type.h:98
@ FOUNDATION_HALFTILE_W
Level west halftile non-continuously.
Definition: slope_type.h:102
@ FOUNDATION_HALFTILE_N
Level north halftile non-continuously.
Definition: slope_type.h:105
@ FOUNDATION_INVALID
Used inside "rail_cmd.cpp" to indicate invalid slope/track combination.
Definition: slope_type.h:113
@ FOUNDATION_HALFTILE_E
Level east halftile non-continuously.
Definition: slope_type.h:104
@ FOUNDATION_HALFTILE_S
Level south halftile non-continuously.
Definition: slope_type.h:103
static const uint32_t VALID_LEVEL_CROSSING_SLOPES
Constant bitset with safe slopes for building a level crossing.
Definition: slope_type.h:86
Corner
Enumeration of tile corners.
Definition: slope_type.h:22
#define M(x)
Helper for creating a bitset of slopes.
Definition: slope_type.h:84