OpenTTD Source  20241124-master-g9399a92a4f
track_type.h File Reference

All types related to tracks. More...

#include "core/enum_type.hpp"

Go to the source code of this file.

Typedefs

typedef uint32_t TrackStatus
 

Enumerations

enum  Track : uint8_t {
  TRACK_BEGIN = 0 , TRACK_X = 0 , TRACK_Y = 1 , TRACK_UPPER = 2 ,
  TRACK_LOWER = 3 , TRACK_LEFT = 4 , TRACK_RIGHT = 5 , TRACK_END ,
  INVALID_TRACK = 0xFF
}
 These are used to specify a single track. More...
 
enum  TrackBits : uint8_t {
  TRACK_BIT_NONE = 0U , TRACK_BIT_X = 1U << TRACK_X , TRACK_BIT_Y = 1U << TRACK_Y , TRACK_BIT_UPPER = 1U << TRACK_UPPER ,
  TRACK_BIT_LOWER = 1U << TRACK_LOWER , TRACK_BIT_LEFT = 1U << TRACK_LEFT , TRACK_BIT_RIGHT = 1U << TRACK_RIGHT , TRACK_BIT_CROSS = TRACK_BIT_X | TRACK_BIT_Y ,
  TRACK_BIT_HORZ = TRACK_BIT_UPPER | TRACK_BIT_LOWER , TRACK_BIT_VERT = TRACK_BIT_LEFT | TRACK_BIT_RIGHT , TRACK_BIT_3WAY_NE = TRACK_BIT_X | TRACK_BIT_UPPER | TRACK_BIT_RIGHT , TRACK_BIT_3WAY_SE = TRACK_BIT_Y | TRACK_BIT_LOWER | TRACK_BIT_RIGHT ,
  TRACK_BIT_3WAY_SW = TRACK_BIT_X | TRACK_BIT_LOWER | TRACK_BIT_LEFT , TRACK_BIT_3WAY_NW = TRACK_BIT_Y | TRACK_BIT_UPPER | TRACK_BIT_LEFT , TRACK_BIT_ALL = TRACK_BIT_CROSS | TRACK_BIT_HORZ | TRACK_BIT_VERT , TRACK_BIT_MASK = 0x3FU ,
  TRACK_BIT_WORMHOLE = 0x40U , TRACK_BIT_DEPOT = 0x80U , INVALID_TRACK_BIT = 0xFF
}
 Allow incrementing of Track variables. More...
 
enum  Trackdir : uint8_t {
  TRACKDIR_BEGIN = 0 , TRACKDIR_X_NE = 0 , TRACKDIR_Y_SE = 1 , TRACKDIR_UPPER_E = 2 ,
  TRACKDIR_LOWER_E = 3 , TRACKDIR_LEFT_S = 4 , TRACKDIR_RIGHT_S = 5 , TRACKDIR_RVREV_NE = 6 ,
  TRACKDIR_RVREV_SE = 7 , TRACKDIR_X_SW = 8 , TRACKDIR_Y_NW = 9 , TRACKDIR_UPPER_W = 10 ,
  TRACKDIR_LOWER_W = 11 , TRACKDIR_LEFT_N = 12 , TRACKDIR_RIGHT_N = 13 , TRACKDIR_RVREV_SW = 14 ,
  TRACKDIR_RVREV_NW = 15 , TRACKDIR_END , INVALID_TRACKDIR = 0xFF
}
 Enumeration for tracks and directions. More...
 
enum  TrackdirBits : uint16_t {
  TRACKDIR_BIT_NONE = 0U , TRACKDIR_BIT_X_NE = 1U << TRACKDIR_X_NE , TRACKDIR_BIT_Y_SE = 1U << TRACKDIR_Y_SE , TRACKDIR_BIT_UPPER_E = 1U << TRACKDIR_UPPER_E ,
  TRACKDIR_BIT_LOWER_E = 1U << TRACKDIR_LOWER_E , TRACKDIR_BIT_LEFT_S = 1U << TRACKDIR_LEFT_S , TRACKDIR_BIT_RIGHT_S = 1U << TRACKDIR_RIGHT_S , TRACKDIR_BIT_X_SW = 1U << TRACKDIR_X_SW ,
  TRACKDIR_BIT_Y_NW = 1U << TRACKDIR_Y_NW , TRACKDIR_BIT_UPPER_W = 1U << TRACKDIR_UPPER_W , TRACKDIR_BIT_LOWER_W = 1U << TRACKDIR_LOWER_W , TRACKDIR_BIT_LEFT_N = 1U << TRACKDIR_LEFT_N ,
  TRACKDIR_BIT_RIGHT_N = 1U << TRACKDIR_RIGHT_N , TRACKDIR_BIT_MASK = 0x3F3F , INVALID_TRACKDIR_BIT = 0xFFFF
}
 Allow incrementing of Trackdir variables. More...
 

Detailed Description

All types related to tracks.

Definition in file track_type.h.

Enumeration Type Documentation

◆ Track

enum Track : uint8_t

These are used to specify a single track.

Can be translated to a trackbit with TrackToTrackbit

Enumerator
TRACK_BEGIN 

Used for iterations.

TRACK_X 

Track along the x-axis (north-east to south-west)

TRACK_Y 

Track along the y-axis (north-west to south-east)

TRACK_UPPER 

Track in the upper corner of the tile (north)

TRACK_LOWER 

Track in the lower corner of the tile (south)

TRACK_LEFT 

Track in the left corner of the tile (west)

TRACK_RIGHT 

Track in the right corner of the tile (east)

TRACK_END 

Used for iterations.

INVALID_TRACK 

Flag for an invalid track.

Definition at line 19 of file track_type.h.

◆ TrackBits

enum TrackBits : uint8_t

Allow incrementing of Track variables.

Bitfield corresponding to Track

Enumerator
TRACK_BIT_NONE 

No track.

TRACK_BIT_X 

X-axis track.

TRACK_BIT_Y 

Y-axis track.

TRACK_BIT_UPPER 

Upper track.

TRACK_BIT_LOWER 

Lower track.

TRACK_BIT_LEFT 

Left track.

TRACK_BIT_RIGHT 

Right track.

TRACK_BIT_CROSS 

X-Y-axis cross.

TRACK_BIT_HORZ 

Upper and lower track.

TRACK_BIT_VERT 

Left and right track.

TRACK_BIT_3WAY_NE 

"Arrow" to the north-east

TRACK_BIT_3WAY_SE 

"Arrow" to the south-east

TRACK_BIT_3WAY_SW 

"Arrow" to the south-west

TRACK_BIT_3WAY_NW 

"Arrow" to the north-west

TRACK_BIT_ALL 

All possible tracks.

TRACK_BIT_MASK 

Bitmask for the first 6 bits.

TRACK_BIT_WORMHOLE 

Bitflag for a wormhole (used for tunnels)

TRACK_BIT_DEPOT 

Bitflag for a depot.

INVALID_TRACK_BIT 

Flag for an invalid trackbits value.

Definition at line 35 of file track_type.h.

◆ Trackdir

enum Trackdir : uint8_t

Enumeration for tracks and directions.

These are a combination of tracks and directions. Values are 0-5 in one direction (corresponding to the Track enum) and 8-13 in the other direction. 6, 7, 14 and 15 are used to encode the reversing of road vehicles. Those reversing track dirs are not considered to be 'valid' except in a small corner in the road vehicle controller.

Enumerator
TRACKDIR_BEGIN 

Used for iterations.

TRACKDIR_X_NE 

X-axis and direction to north-east.

TRACKDIR_Y_SE 

Y-axis and direction to south-east.

TRACKDIR_UPPER_E 

Upper track and direction to east.

TRACKDIR_LOWER_E 

Lower track and direction to east.

TRACKDIR_LEFT_S 

Left track and direction to south.

TRACKDIR_RIGHT_S 

Right track and direction to south.

TRACKDIR_RVREV_NE 

(Road vehicle) reverse direction north-east

TRACKDIR_RVREV_SE 

(Road vehicle) reverse direction south-east

TRACKDIR_X_SW 

X-axis and direction to south-west.

TRACKDIR_Y_NW 

Y-axis and direction to north-west.

TRACKDIR_UPPER_W 

Upper track and direction to west.

TRACKDIR_LOWER_W 

Lower track and direction to west.

TRACKDIR_LEFT_N 

Left track and direction to north.

TRACKDIR_RIGHT_N 

Right track and direction to north.

TRACKDIR_RVREV_SW 

(Road vehicle) reverse direction south-west

TRACKDIR_RVREV_NW 

(Road vehicle) reverse direction north-west

TRACKDIR_END 

Used for iterations.

INVALID_TRACKDIR 

Flag for an invalid trackdir.

Definition at line 67 of file track_type.h.

◆ TrackdirBits

enum TrackdirBits : uint16_t

Allow incrementing of Trackdir variables.

Enumeration of bitmasks for the TrackDirs

These are a combination of tracks and directions. Values are 0-5 in one direction (corresponding to the Track enum) and 8-13 in the other direction.

Enumerator
TRACKDIR_BIT_NONE 

No track build.

TRACKDIR_BIT_X_NE 

Track x-axis, direction north-east.

TRACKDIR_BIT_Y_SE 

Track y-axis, direction south-east.

TRACKDIR_BIT_UPPER_E 

Track upper, direction east.

TRACKDIR_BIT_LOWER_E 

Track lower, direction east.

TRACKDIR_BIT_LEFT_S 

Track left, direction south.

TRACKDIR_BIT_RIGHT_S 

Track right, direction south.

TRACKDIR_BIT_X_SW 

Track x-axis, direction south-west.

TRACKDIR_BIT_Y_NW 

Track y-axis, direction north-west.

TRACKDIR_BIT_UPPER_W 

Track upper, direction west.

TRACKDIR_BIT_LOWER_W 

Track lower, direction west.

TRACKDIR_BIT_LEFT_N 

Track left, direction north.

TRACKDIR_BIT_RIGHT_N 

Track right, direction north.

TRACKDIR_BIT_MASK 

Bitmask for bit-operations.

INVALID_TRACKDIR_BIT 

Flag for an invalid trackdirbit value.

Definition at line 98 of file track_type.h.