OpenTTD Source 20250918-master-g2d13bcb7b9
track_data.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/* Maps a diagonal direction to the all trackdirs that are connected to any
11 * track entering in this direction (including those making 90 degree turns)
12 */
13extern const TrackdirBits _exitdir_reaches_trackdirs[] = {
18};
19
20extern const Trackdir _next_trackdir[TRACKDIR_END] = {
23};
24
25/* Maps a trackdir to all trackdirs that make 90 deg turns with it. */
26extern const TrackdirBits _track_crosses_trackdirs[TRACK_END] = {
33};
34
35/* Maps a track to all tracks that make 90 deg turns with it. */
36extern const TrackBits _track_crosses_tracks[] = {
37 TRACK_BIT_Y, // TRACK_X
38 TRACK_BIT_X, // TRACK_Y
39 TRACK_BIT_VERT, // TRACK_UPPER
40 TRACK_BIT_VERT, // TRACK_LOWER
41 TRACK_BIT_HORZ, // TRACK_LEFT
42 TRACK_BIT_HORZ // TRACK_RIGHT
43};
44
45/* Maps a trackdir to the (4-way) direction the tile is exited when following
46 * that trackdir */
47extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END] = {
50};
51
52extern const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
59};
60
61extern const Trackdir _track_enterdir_to_trackdir[][DIAGDIR_END] = {
68};
69
70extern const Trackdir _track_direction_to_trackdir[][DIR_END] = {
77};
78
79extern const Trackdir _dir_to_diag_trackdir[] = {
81};
82
83extern const TrackBits _corner_to_trackbits[] = {
85};
86
87extern const TrackdirBits _uphill_trackdirs[] = {
119};
@ DIR_END
Used to iterate.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ DIAGDIR_NW
Northwest.
@ DIAGDIR_SE
Southeast.
@ DIAGDIR_END
Used for iterations.
@ DIAGDIR_SW
Southwest.
TrackBits
Allow incrementing of Track variables.
Definition track_type.h:35
@ TRACK_BIT_UPPER
Upper track.
Definition track_type.h:39
@ TRACK_BIT_LEFT
Left track.
Definition track_type.h:41
@ TRACK_BIT_Y
Y-axis track.
Definition track_type.h:38
@ TRACK_BIT_HORZ
Upper and lower track.
Definition track_type.h:44
@ TRACK_BIT_X
X-axis track.
Definition track_type.h:37
@ TRACK_BIT_LOWER
Lower track.
Definition track_type.h:40
@ TRACK_BIT_RIGHT
Right track.
Definition track_type.h:42
@ TRACK_BIT_VERT
Left and right track.
Definition track_type.h:45
Trackdir
Enumeration for tracks and directions.
Definition track_type.h:66
@ TRACKDIR_X_NE
X-axis and direction to north-east.
Definition track_type.h:68
@ TRACKDIR_LOWER_E
Lower track and direction to east.
Definition track_type.h:71
@ TRACKDIR_RIGHT_N
Right track and direction to north.
Definition track_type.h:81
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
Definition track_type.h:85
@ TRACKDIR_UPPER_E
Upper track and direction to east.
Definition track_type.h:70
@ TRACKDIR_Y_SE
Y-axis and direction to south-east.
Definition track_type.h:69
@ TRACKDIR_LEFT_S
Left track and direction to south.
Definition track_type.h:72
@ TRACKDIR_UPPER_W
Upper track and direction to west.
Definition track_type.h:78
@ TRACKDIR_X_SW
X-axis and direction to south-west.
Definition track_type.h:76
@ TRACKDIR_LOWER_W
Lower track and direction to west.
Definition track_type.h:79
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
Definition track_type.h:77
@ TRACKDIR_END
Used for iterations.
Definition track_type.h:84
@ TRACKDIR_RIGHT_S
Right track and direction to south.
Definition track_type.h:73
@ TRACKDIR_LEFT_N
Left track and direction to north.
Definition track_type.h:80
TrackdirBits
Allow incrementing of Trackdir variables.
Definition track_type.h:97
@ TRACKDIR_BIT_LEFT_S
Track left, direction south.
Definition track_type.h:103
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
Definition track_type.h:107
@ TRACKDIR_BIT_UPPER_E
Track upper, direction east.
Definition track_type.h:101
@ TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
Definition track_type.h:99
@ TRACKDIR_BIT_LOWER_E
Track lower, direction east.
Definition track_type.h:102
@ TRACKDIR_BIT_LEFT_N
Track left, direction north.
Definition track_type.h:110
@ TRACKDIR_BIT_RIGHT_S
Track right, direction south.
Definition track_type.h:104
@ TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
Definition track_type.h:100
@ TRACKDIR_BIT_NONE
No track build.
Definition track_type.h:98
@ TRACKDIR_BIT_RIGHT_N
Track right, direction north.
Definition track_type.h:111
@ TRACKDIR_BIT_UPPER_W
Track upper, direction west.
Definition track_type.h:108
@ TRACKDIR_BIT_LOWER_W
Track lower, direction west.
Definition track_type.h:109
@ TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
Definition track_type.h:106
@ TRACK_END
Used for iterations.
Definition track_type.h:27