OpenTTD Source 20260421-master-gc2fbc6fdeb
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
using RoadTypes = EnumBitSet<RoadType, uint64_t>
using RoadTramTypes = EnumBitSet<RoadTramType, uint8_t>
 Bitset of RoadTramType elements.
using RoadBits = EnumBitSet<RoadBit, uint8_t>
 Bitset of RoadBit elements.
using DisallowedRoadDirections = EnumBitSet<DisallowedRoadDirection, uint8_t>
 Bitset of DisallowedRoadDirection elements.

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 class  RoadTramType : uint8_t { Road , Tram , End , Invalid = 0xFF }
 The different types of road type. More...
enum class  RoadBit : uint8_t { NW = 0 , SW = 1 , SE = 2 , NE = 3 }
 Enumeration for the road parts on a tile. More...
enum class  DisallowedRoadDirection : uint8_t { Southbound , Northbound , End }
 Which directions are disallowed ? More...

Variables

static const RoadTypeLabel ROADTYPE_LABEL_ROAD = 'ROAD'
static const RoadTypeLabel ROADTYPE_LABEL_TRAM = 'ELRL'
static constexpr RoadTramTypes ROADTRAMTYPES_ALL {RoadTramType::Road, RoadTramType::Tram}
 All possible RoadTramTypes.
static constexpr RoadBits ROAD_X {RoadBit::SW, RoadBit::NE}
 Full road along the x-axis (south-west + north-east).
static constexpr RoadBits ROAD_Y {RoadBit::NW, RoadBit::SE}
 Full road along the y-axis (north-west + south-east).
static constexpr RoadBits ROAD_N {RoadBit::NE, RoadBit::NW}
 Road at the two northern edges.
static constexpr RoadBits ROAD_E {RoadBit::NE, RoadBit::SE}
 Road at the two eastern edges.
static constexpr RoadBits ROAD_S {RoadBit::SE, RoadBit::SW}
 Road at the two southern edges.
static constexpr RoadBits ROAD_W {RoadBit::NW, RoadBit::SW}
 Road at the two western edges.
static constexpr RoadBits ROAD_ALL {RoadBit::NW, RoadBit::SW, RoadBit::SE, RoadBit::NE}
 Full 4-way crossing.

Detailed Description

Enums and other types related to roads.

Definition in file road_type.h.

Typedef Documentation

◆ DisallowedRoadDirections

Bitset of DisallowedRoadDirection elements.

Definition at line 84 of file road_type.h.

◆ RoadBits

using RoadBits = EnumBitSet<RoadBit, uint8_t>

Bitset of RoadBit elements.

Definition at line 64 of file road_type.h.

◆ RoadTramTypes

Bitset of RoadTramType elements.

Definition at line 45 of file road_type.h.

◆ RoadTypeLabel

typedef uint32_t RoadTypeLabel

Definition at line 15 of file road_type.h.

◆ RoadTypes

using RoadTypes = EnumBitSet<RoadType, uint64_t>

Definition at line 32 of file road_type.h.

Enumeration Type Documentation

◆ DisallowedRoadDirection

enum class DisallowedRoadDirection : uint8_t
strong

Which directions are disallowed ?

Enumerator
Southbound 

All southbound traffic is disallowed.

Northbound 

All northbound traffic is disallowed.

End 

End marker.

Definition at line 77 of file road_type.h.

◆ RoadBit

enum class RoadBit : uint8_t
strong

Enumeration for the road parts on a tile.

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

Enumerator
NW 

North-west part.

SW 

South-west part.

SE 

South-east part.

NE 

North-east part.

Definition at line 56 of file road_type.h.

◆ RoadTramType

enum class RoadTramType : uint8_t
strong

The different types of road type.

Enumerator
Road 

Road type.

Tram 

Tram type.

End 

End marker.

Invalid 

Invalid marker.

Definition at line 37 of file road_type.h.

◆ RoadType

enum RoadType : uint8_t

The different roadtypes we support.

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 23 of file road_type.h.

Variable Documentation

◆ ROAD_ALL

RoadBits ROAD_ALL {RoadBit::NW, RoadBit::SW, RoadBit::SE, RoadBit::NE}
staticconstexpr

Full 4-way crossing.

Definition at line 74 of file road_type.h.

Referenced by ComplementRoadBits(), GetTownRoadGridElement(), and IsValidRoadBits().

◆ ROAD_E

RoadBits ROAD_E {RoadBit::NE, RoadBit::SE}
staticconstexpr

Road at the two eastern edges.

Definition at line 70 of file road_type.h.

Referenced by GrowTownInTile().

◆ ROAD_N

RoadBits ROAD_N {RoadBit::NE, RoadBit::NW}
staticconstexpr

Road at the two northern edges.

Definition at line 69 of file road_type.h.

Referenced by GrowTownInTile().

◆ ROAD_S

RoadBits ROAD_S {RoadBit::SE, RoadBit::SW}
staticconstexpr

Road at the two southern edges.

Definition at line 71 of file road_type.h.

Referenced by GrowTownInTile().

◆ ROAD_W

RoadBits ROAD_W {RoadBit::NW, RoadBit::SW}
staticconstexpr

Road at the two western edges.

Definition at line 72 of file road_type.h.

Referenced by GrowTownInTile().

◆ ROAD_X

◆ ROAD_Y

◆ ROADTRAMTYPES_ALL

◆ ROADTYPE_LABEL_ROAD

const RoadTypeLabel ROADTYPE_LABEL_ROAD = 'ROAD'
static

Definition at line 17 of file road_type.h.

◆ ROADTYPE_LABEL_TRAM

const RoadTypeLabel ROADTYPE_LABEL_TRAM = 'ELRL'
static

Definition at line 18 of file road_type.h.