OpenTTD Source 20260531-master-g0e951f3528
track_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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef TRACK_TYPE_H
11#define TRACK_TYPE_H
12
13#include "core/enum_type.hpp"
14
30
33
34
38template <typename T>
40
63
64
94
97
98
102template <typename T>
104
130
131
136
137#endif /* TRACK_TYPE_H */
Type (helpers) for enums.
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Definition enum_type.hpp:86
EnumClassIndexContainer< std::array< T, to_underlying(N)>, Index > EnumIndexArray
A typedef for EnumClassIndexContainer using std::array as the backing container type.
Track status of a tile.
Definition track_type.h:132
TrackdirBits signals
Red signals on the tile.
Definition track_type.h:134
TrackdirBits trackdirs
Trackdirs present on the tile.
Definition track_type.h:133
TrackBits
Bitfield corresponding to Track.
Definition track_type.h:42
@ TRACK_BIT_WORMHOLE
Bitflag for a wormhole (used for tunnels).
Definition track_type.h:59
@ TRACK_BIT_UPPER
Upper track.
Definition track_type.h:46
@ TRACK_BIT_DEPOT
Bitflag for a depot.
Definition track_type.h:60
@ TRACK_BIT_LEFT
Left track.
Definition track_type.h:48
@ TRACK_BIT_Y
Y-axis track.
Definition track_type.h:45
@ TRACK_BIT_CROSS
X-Y-axis cross.
Definition track_type.h:50
@ TRACK_BIT_HORZ
Upper and lower track.
Definition track_type.h:51
@ TRACK_BIT_NONE
No track.
Definition track_type.h:43
@ TRACK_BIT_3WAY_NW
"Arrow" to the north-west
Definition track_type.h:56
@ TRACK_BIT_X
X-axis track.
Definition track_type.h:44
@ TRACK_BIT_MASK
Bitmask for the first 6 bits.
Definition track_type.h:58
@ TRACK_BIT_LOWER
Lower track.
Definition track_type.h:47
@ TRACK_BIT_ALL
All possible tracks.
Definition track_type.h:57
@ TRACK_BIT_3WAY_NE
"Arrow" to the north-east
Definition track_type.h:53
@ TRACK_BIT_RIGHT
Right track.
Definition track_type.h:49
@ TRACK_BIT_3WAY_SW
"Arrow" to the south-west
Definition track_type.h:55
@ TRACK_BIT_VERT
Left and right track.
Definition track_type.h:52
@ TRACK_BIT_3WAY_SE
"Arrow" to the south-east
Definition track_type.h:54
EnumIndexArray< T, Trackdir, TRACKDIR_END > TrackdirIndexArray
Allow incrementing of Trackdir variables.
Definition track_type.h:103
EnumIndexArray< T, Track, TRACK_END > TrackIndexArray
Allow incrementing of Track variables.
Definition track_type.h:39
Trackdir
Enumeration for tracks and directions.
Definition track_type.h:73
@ TRACKDIR_RVREV_NE
(Road vehicle) reverse direction north-east
Definition track_type.h:81
@ TRACKDIR_X_NE
X-axis and direction to north-east.
Definition track_type.h:75
@ TRACKDIR_LOWER_E
Lower track and direction to east.
Definition track_type.h:78
@ TRACKDIR_RIGHT_N
Right track and direction to north.
Definition track_type.h:88
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
Definition track_type.h:92
@ TRACKDIR_UPPER_E
Upper track and direction to east.
Definition track_type.h:77
@ TRACKDIR_Y_SE
Y-axis and direction to south-east.
Definition track_type.h:76
@ TRACKDIR_LEFT_S
Left track and direction to south.
Definition track_type.h:79
@ TRACKDIR_UPPER_W
Upper track and direction to west.
Definition track_type.h:85
@ TRACKDIR_RVREV_SE
(Road vehicle) reverse direction south-east
Definition track_type.h:82
@ TRACKDIR_X_SW
X-axis and direction to south-west.
Definition track_type.h:83
@ TRACKDIR_LOWER_W
Lower track and direction to west.
Definition track_type.h:86
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
Definition track_type.h:84
@ TRACKDIR_END
Used for iterations.
Definition track_type.h:91
@ TRACKDIR_RIGHT_S
Right track and direction to south.
Definition track_type.h:80
@ TRACKDIR_BEGIN
Used for iterations.
Definition track_type.h:74
@ TRACKDIR_RVREV_NW
(Road vehicle) reverse direction north-west
Definition track_type.h:90
@ TRACKDIR_RVREV_SW
(Road vehicle) reverse direction south-west
Definition track_type.h:89
@ TRACKDIR_LEFT_N
Left track and direction to north.
Definition track_type.h:87
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
Definition track_type.h:111
@ TRACKDIR_BIT_LEFT_S
Track left, direction south.
Definition track_type.h:117
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
Definition track_type.h:121
@ TRACKDIR_BIT_UPPER_E
Track upper, direction east.
Definition track_type.h:115
@ TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
Definition track_type.h:113
@ TRACKDIR_BIT_LOWER_E
Track lower, direction east.
Definition track_type.h:116
@ TRACKDIR_BIT_LEFT_N
Track left, direction north.
Definition track_type.h:124
@ TRACKDIR_BIT_RIGHT_S
Track right, direction south.
Definition track_type.h:118
@ TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
Definition track_type.h:114
@ TRACKDIR_BIT_NONE
No track build.
Definition track_type.h:112
@ TRACKDIR_BIT_RIGHT_N
Track right, direction north.
Definition track_type.h:125
@ TRACKDIR_BIT_MASK
Bitmask for bit-operations.
Definition track_type.h:126
@ TRACKDIR_BIT_UPPER_W
Track upper, direction west.
Definition track_type.h:122
@ TRACKDIR_BIT_LOWER_W
Track lower, direction west.
Definition track_type.h:123
@ INVALID_TRACKDIR_BIT
Flag for an invalid trackdirbit value.
Definition track_type.h:127
@ TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
Definition track_type.h:120
Track
These are used to specify a single track.
Definition track_type.h:19
@ INVALID_TRACK
Flag for an invalid track.
Definition track_type.h:28
@ TRACK_Y
Track along the y-axis (north-west to south-east).
Definition track_type.h:22
@ TRACK_LOWER
Track in the lower corner of the tile (south).
Definition track_type.h:24
@ TRACK_END
Used for iterations.
Definition track_type.h:27
@ TRACK_LEFT
Track in the left corner of the tile (west).
Definition track_type.h:25
@ TRACK_RIGHT
Track in the right corner of the tile (east).
Definition track_type.h:26
@ TRACK_BEGIN
Used for iterations.
Definition track_type.h:20
@ TRACK_X
Track along the x-axis (north-east to south-west).
Definition track_type.h:21
@ TRACK_UPPER
Track in the upper corner of the tile (north).
Definition track_type.h:23