OpenTTD Source  20241121-master-g67a0fccfad
road_type.h File Reference

Enums and other types related to roads. More...

#include "core/enum_type.hpp"

Go to the source code of this file.

Typedefs

typedef uint32_t RoadTypeLabel
 

Enumerations

enum  RoadType : uint8_t {
  ROADTYPE_BEGIN = 0 , ROADTYPE_ROAD = 0 , ROADTYPE_TRAM = 1 , ROADTYPE_END = 63 ,
  INVALID_ROADTYPE = 63
}
 The different roadtypes we support. More...
 
enum  RoadTypes : uint64_t { ROADTYPES_NONE = 0 , ROADTYPES_ROAD = 1 << ROADTYPE_ROAD , ROADTYPES_TRAM = 1 << ROADTYPE_TRAM , INVALID_ROADTYPES = UINT64_MAX }
 The different roadtypes we support, but then a bitmask of them. More...
 
enum  RoadBits : uint8_t {
  ROAD_NONE = 0U , ROAD_NW = 1U , ROAD_SW = 2U , ROAD_SE = 4U ,
  ROAD_NE = 8U , ROAD_X = ROAD_SW | ROAD_NE , ROAD_Y = ROAD_NW | ROAD_SE , ROAD_N = ROAD_NE | ROAD_NW ,
  ROAD_E = ROAD_NE | ROAD_SE , ROAD_S = ROAD_SE | ROAD_SW , ROAD_W = ROAD_NW | ROAD_SW , ROAD_ALL = ROAD_X | ROAD_Y ,
  ROAD_END = ROAD_ALL + 1
}
 Enumeration for the road parts on a tile. More...
 
enum  DisallowedRoadDirections : uint8_t {
  DRD_NONE , DRD_SOUTHBOUND , DRD_NORTHBOUND , DRD_BOTH ,
  DRD_END
}
 Which directions are disallowed ? More...
 

Variables

static const RoadTypeLabel ROADTYPE_LABEL_ROAD = 'ROAD'
 
static const RoadTypeLabel ROADTYPE_LABEL_TRAM = 'ELRL'
 

Detailed Description

Enums and other types related to roads.

Definition in file road_type.h.

Enumeration Type Documentation

◆ DisallowedRoadDirections

enum DisallowedRoadDirections : uint8_t

Which directions are disallowed ?

Enumerator
DRD_NONE 

None of the directions are disallowed.

DRD_SOUTHBOUND 

All southbound traffic is disallowed.

DRD_NORTHBOUND 

All northbound traffic is disallowed.

DRD_BOTH 

All directions are disallowed.

DRD_END 

Sentinel.

Definition at line 73 of file road_type.h.

◆ RoadBits

enum RoadBits : uint8_t

Enumeration for the road parts on a tile.

This enumeration defines the possible road parts which can be build on a tile.

Enumerator
ROAD_NONE 

No road-part is build.

ROAD_NW 

North-west part.

ROAD_SW 

South-west part.

ROAD_SE 

South-east part.

ROAD_NE 

North-east part.

ROAD_X 

Full road along the x-axis (south-west + north-east)

ROAD_Y 

Full road along the y-axis (north-west + south-east)

ROAD_N 

Road at the two northern edges.

ROAD_E 

Road at the two eastern edges.

ROAD_S 

Road at the two southern edges.

ROAD_W 

Road at the two western edges.

ROAD_ALL 

Full 4-way crossing.

ROAD_END 

Out-of-range roadbits, used for iterations.

Definition at line 52 of file road_type.h.

◆ RoadType

enum RoadType : uint8_t

The different roadtypes we support.

Note
currently only ROADTYPE_ROAD and ROADTYPE_TRAM are supported.
Enumerator
ROADTYPE_BEGIN 

Used for iterations.

ROADTYPE_ROAD 

Basic road type.

ROADTYPE_TRAM 

Trams.

ROADTYPE_END 

Used for iterations.

INVALID_ROADTYPE 

flag for invalid roadtype

Definition at line 25 of file road_type.h.

◆ RoadTypes

enum RoadTypes : uint64_t

The different roadtypes we support, but then a bitmask of them.

Note
Must be treated as a uint64_t type, narrowing it causes bit membership tests to give wrong results.
Enumerator
ROADTYPES_NONE 

No roadtypes.

ROADTYPES_ROAD 

Road.

ROADTYPES_TRAM 

Trams.

INVALID_ROADTYPES 

Invalid roadtypes.

Definition at line 38 of file road_type.h.