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

The different types of rail. More...

#include "core/enum_type.hpp"

Go to the source code of this file.

Typedefs

typedef uint32_t RailTypeLabel
 

Enumerations

enum  RailType : uint8_t {
  RAILTYPE_BEGIN = 0 , RAILTYPE_RAIL = 0 , RAILTYPE_ELECTRIC = 1 , RAILTYPE_MONO = 2 ,
  RAILTYPE_MAGLEV = 3 , RAILTYPE_END = 64 , INVALID_RAILTYPE = 0xFF
}
 Enumeration for all possible railtypes. More...
 
enum  RailTypes : uint64_t {
  RAILTYPES_NONE = 0 , RAILTYPES_RAIL = 1 << RAILTYPE_RAIL , RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC , RAILTYPES_MONO = 1 << RAILTYPE_MONO ,
  RAILTYPES_MAGLEV = 1 << RAILTYPE_MAGLEV , INVALID_RAILTYPES = UINT64_MAX
}
 Allow incrementing of Track variables. More...
 

Variables

static const RailTypeLabel RAILTYPE_LABEL_RAIL = 'RAIL'
 
static const RailTypeLabel RAILTYPE_LABEL_ELECTRIC = 'ELRL'
 
static const RailTypeLabel RAILTYPE_LABEL_MONO = 'MONO'
 
static const RailTypeLabel RAILTYPE_LABEL_MAGLEV = 'MGLV'
 

Detailed Description

The different types of rail.

Definition in file rail_type.h.

Enumeration Type Documentation

◆ RailType

enum RailType : uint8_t

Enumeration for all possible railtypes.

This enumeration defines all 4 possible railtypes.

Enumerator
RAILTYPE_BEGIN 

Used for iterations.

RAILTYPE_RAIL 

Standard non-electric rails.

RAILTYPE_ELECTRIC 

Electric rails.

RAILTYPE_MONO 

Monorail.

RAILTYPE_MAGLEV 

Maglev.

RAILTYPE_END 

Used for iterations.

INVALID_RAILTYPE 

Flag for invalid railtype.

Definition at line 27 of file rail_type.h.

◆ RailTypes

enum RailTypes : uint64_t

Allow incrementing of Track variables.

The different railtypes 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, as in bug #6951.
Enumerator
RAILTYPES_NONE 

No rail types.

RAILTYPES_RAIL 

Non-electrified rails.

RAILTYPES_ELECTRIC 

Electrified rails.

RAILTYPES_MONO 

Monorail!

RAILTYPES_MAGLEV 

Ever fast maglev.

INVALID_RAILTYPES 

Invalid railtypes.

Definition at line 44 of file rail_type.h.