OpenTTD Source 20241224-master-gf74b0cf984
RailTypeInfo Class Reference

This struct contains all the info that is needed to draw and construct tracks. More...

#include <rail.h>

Public Member Functions

bool UsesOverlay () const
 
uint GetRailtypeSpriteOffset () const
 Offset between the current railtype and normal rail.
 

Data Fields

struct { 
 
   SpriteID   track_y 
 single piece of rail in Y direction, with ground More...
 
   SpriteID   track_ns 
 two pieces of rail in North and South corner (East-West direction) More...
 
   SpriteID   ground 
 ground sprite for a 3-way switch More...
 
   SpriteID   single_x 
 single piece of rail in X direction, without ground More...
 
   SpriteID   single_y 
 single piece of rail in Y direction, without ground More...
 
   SpriteID   single_n 
 single piece of rail in the northern corner More...
 
   SpriteID   single_s 
 single piece of rail in the southern corner More...
 
   SpriteID   single_e 
 single piece of rail in the eastern corner More...
 
   SpriteID   single_w 
 single piece of rail in the western corner More...
 
   SpriteID   single_sloped 
 single piece of rail for slopes More...
 
   SpriteID   crossing 
 level crossing, rail in X direction More...
 
   SpriteID   tunnel 
 tunnel sprites base More...
 
base_sprites 
 Struct containing the main sprites.
 
struct { 
 
   SpriteID   build_ns_rail 
 button for building single rail in N-S direction More...
 
   SpriteID   build_x_rail 
 button for building single rail in X direction More...
 
   SpriteID   build_ew_rail 
 button for building single rail in E-W direction More...
 
   SpriteID   build_y_rail 
 button for building single rail in Y direction More...
 
   SpriteID   auto_rail 
 button for the autorail construction More...
 
   SpriteID   build_depot 
 button for building depots More...
 
   SpriteID   build_tunnel 
 button for building a tunnel More...
 
   SpriteID   convert_rail 
 button for converting rail More...
 
   SpriteID   signals [SIGTYPE_END][2][2] 
 signal GUI sprites (type, variant, state) More...
 
gui_sprites 
 struct containing the sprites for the rail GUI.
 
struct { 
 
   CursorID   rail_ns 
 Cursor for building rail in N-S direction. More...
 
   CursorID   rail_swne 
 Cursor for building rail in X direction. More...
 
   CursorID   rail_ew 
 Cursor for building rail in E-W direction. More...
 
   CursorID   rail_nwse 
 Cursor for building rail in Y direction. More...
 
   CursorID   autorail 
 Cursor for autorail tool. More...
 
   CursorID   depot 
 Cursor for building a depot. More...
 
   CursorID   tunnel 
 Cursor for building a tunnel. More...
 
   CursorID   convert 
 Cursor for converting track. More...
 
cursor 
 Cursors associated with the rail type.
 
struct { 
 
   StringID   name 
 Name of this rail type. More...
 
   StringID   toolbar_caption 
 Caption in the construction toolbar GUI for this rail type. More...
 
   StringID   menu_text 
 Name of this rail type in the main toolbar dropdown. More...
 
   StringID   build_caption 
 Caption of the build vehicle GUI for this rail type. More...
 
   StringID   replace_text 
 Text used in the autoreplace GUI. More...
 
   StringID   new_loco 
 Name of an engine for this type of rail in the engine preview GUI. More...
 
strings 
 Strings associated with the rail type.
 
SpriteID snow_offset
 sprite number difference between a piece of track on a snowy ground and the corresponding one on normal ground
 
RailTypes powered_railtypes
 bitmask to the OTHER railtypes on which an engine of THIS railtype generates power
 
RailTypes compatible_railtypes
 bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel
 
SpriteID bridge_offset
 Bridge offset.
 
uint8_t fallback_railtype
 Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.
 
uint8_t curve_speed
 Multiplier for curve maximum speed advantage.
 
RailTypeFlags flags
 Bit mask of rail type flags.
 
uint16_t cost_multiplier
 Cost multiplier for building this rail type.
 
uint16_t maintenance_multiplier
 Cost multiplier for maintenance of this rail type.
 
uint8_t acceleration_type
 Acceleration type of this rail type.
 
uint16_t max_speed
 Maximum speed for vehicles travelling on this rail type.
 
RailTypeLabel label
 Unique 32 bit rail type identifier.
 
RailTypeLabelList alternate_labels
 Rail type labels this type provides in addition to the main label.
 
uint8_t map_colour
 Colour on mini-map.
 
TimerGameCalendar::Date introduction_date
 Introduction date.
 
RailTypes introduction_required_railtypes
 Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_date.
 
RailTypes introduces_railtypes
 Bitmask of which other railtypes are introduced when this railtype is introduced.
 
uint8_t sorting_order
 The sorting order of this railtype for the toolbar dropdown.
 
const GRFFilegrffile [RTSG_END]
 NewGRF providing the Action3 for the railtype.
 
const SpriteGroupgroup [RTSG_END]
 Sprite groups for resolving sprites.
 

Detailed Description

This struct contains all the info that is needed to draw and construct tracks.

Definition at line 127 of file rail.h.

Member Function Documentation

◆ GetRailtypeSpriteOffset()

uint RailTypeInfo::GetRailtypeSpriteOffset ( ) const
inline

Offset between the current railtype and normal rail.

This means that:

1) All the sprites in a railset MUST be in the same order. This order is determined by normal rail. Check sprites 1005 and following for this order

2) The position where the railtype is loaded must always be the same, otherwise the offset will fail.

Definition at line 295 of file rail.h.

References fallback_railtype.

Referenced by DrawStationTile().

◆ UsesOverlay()

bool RailTypeInfo::UsesOverlay ( ) const
inline

Definition at line 283 of file rail.h.

Field Documentation

◆ acceleration_type

uint8_t RailTypeInfo::acceleration_type

Acceleration type of this rail type.

Definition at line 226 of file rail.h.

Referenced by AffectSpeedByZChange(), Train::GetAccelerationType(), RailTypeChangeInfo(), and TrainController().

◆ alternate_labels

RailTypeLabelList RailTypeInfo::alternate_labels

Rail type labels this type provides in addition to the main label.

Definition at line 241 of file rail.h.

Referenced by AllocateRailType(), and GetRailTypeByLabel().

◆ auto_rail

SpriteID RailTypeInfo::auto_rail

button for the autorail construction

Definition at line 157 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ autorail

CursorID RailTypeInfo::autorail

Cursor for autorail tool.

Definition at line 169 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ [struct]

struct { ... } RailTypeInfo::base_sprites

Struct containing the main sprites.

Note
not all sprites are listed, but only the ones used directly in the code

Referenced by DrawBridgeMiddle(), DrawTile_Road(), DrawTile_TunnelBridge(), and DrawTrackBits().

◆ bridge_offset

SpriteID RailTypeInfo::bridge_offset

Bridge offset.

Definition at line 196 of file rail.h.

Referenced by DrawBridgeMiddle(), and DrawTile_TunnelBridge().

◆ build_caption

StringID RailTypeInfo::build_caption

Caption of the build vehicle GUI for this rail type.

Definition at line 179 of file rail.h.

Referenced by RailTypeChangeInfo(), and BuildVehicleWindow::SetStringParameters().

◆ build_depot

SpriteID RailTypeInfo::build_depot

button for building depots

Definition at line 158 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ build_ew_rail

SpriteID RailTypeInfo::build_ew_rail

button for building single rail in E-W direction

Definition at line 155 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ build_ns_rail

SpriteID RailTypeInfo::build_ns_rail

button for building single rail in N-S direction

Definition at line 153 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ build_tunnel

SpriteID RailTypeInfo::build_tunnel

button for building a tunnel

Definition at line 159 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ build_x_rail

SpriteID RailTypeInfo::build_x_rail

button for building single rail in X direction

Definition at line 154 of file rail.h.

Referenced by GetRailTypeDropDownList(), and BuildRailToolbarWindow::OnInit().

◆ build_y_rail

SpriteID RailTypeInfo::build_y_rail

button for building single rail in Y direction

Definition at line 156 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ compatible_railtypes

RailTypes RailTypeInfo::compatible_railtypes

bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel

Definition at line 191 of file rail.h.

Referenced by AllocateRailType(), CheckAutoreplaceValidity(), FollowTrainReservation(), FreeTrainTrackReservation(), GetTrainForReservation(), IsSafeWaitingPosition(), IsWaitingPositionFree(), and RailTypeChangeInfo().

◆ convert

CursorID RailTypeInfo::convert

Cursor for converting track.

Definition at line 172 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ convert_rail

SpriteID RailTypeInfo::convert_rail

button for converting rail

Definition at line 160 of file rail.h.

Referenced by BuildRailToolbarWindow::OnInit().

◆ cost_multiplier

uint16_t RailTypeInfo::cost_multiplier

Cost multiplier for building this rail type.

Definition at line 216 of file rail.h.

Referenced by ParamSet(), and RailTypeChangeInfo().

◆ crossing

SpriteID RailTypeInfo::crossing

level crossing, rail in X direction

Definition at line 144 of file rail.h.

Referenced by DrawTile_Road().

◆ curve_speed

uint8_t RailTypeInfo::curve_speed

Multiplier for curve maximum speed advantage.

Definition at line 206 of file rail.h.

Referenced by Train::GetCurveSpeedLimit(), and RailTypeChangeInfo().

◆ depot

CursorID RailTypeInfo::depot

Cursor for building a depot.

Definition at line 170 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ fallback_railtype

uint8_t RailTypeInfo::fallback_railtype

Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.

Definition at line 201 of file rail.h.

Referenced by DrawStationTile(), GetRailtypeSpriteOffset(), and RailTypeChangeInfo().

◆ flags

RailTypeFlags RailTypeInfo::flags

Bit mask of rail type flags.

Definition at line 211 of file rail.h.

Referenced by InitRailTypes(), Rail90DegTurnDisallowed(), and RailTypeChangeInfo().

◆ grffile

const GRFFile* RailTypeInfo::grffile[RTSG_END]

NewGRF providing the Action3 for the railtype.

nullptr if not available.

Definition at line 276 of file rail.h.

◆ ground

SpriteID RailTypeInfo::ground

ground sprite for a 3-way switch

Definition at line 136 of file rail.h.

Referenced by DrawTrackBits().

◆ group

const SpriteGroup* RailTypeInfo::group[RTSG_END]

Sprite groups for resolving sprites.

Definition at line 281 of file rail.h.

Referenced by GetCustomRailSprite(), GetCustomSignalSprite(), and RailTypeResolverObject::RailTypeResolverObject().

◆ [struct]

struct { ... } RailTypeInfo::gui_sprites

struct containing the sprites for the rail GUI.

Note
only sprites referred to directly in the code are listed

Referenced by BuildSignalWindow::DrawWidget(), GetRailTypeDropDownList(), BuildRailToolbarWindow::OnInit(), and BuildSignalWindow::OnInit().

◆ introduces_railtypes

RailTypes RailTypeInfo::introduces_railtypes

Bitmask of which other railtypes are introduced when this railtype is introduced.

Definition at line 266 of file rail.h.

Referenced by AddDateIntroducedRailTypes(), AllocateRailType(), GetCompanyRailTypes(), GetRailTypes(), NewVehicleAvailable(), and RailTypeChangeInfo().

◆ introduction_date

TimerGameCalendar::Date RailTypeInfo::introduction_date

Introduction date.

When #INVALID_DATE or a vehicle using this railtype gets introduced earlier, the vehicle's introduction date will be used instead for this railtype. The introduction at this date is furthermore limited by the introduction_required_railtypes.

Definition at line 255 of file rail.h.

Referenced by AddDateIntroducedRailTypes(), and RailTypeChangeInfo().

◆ introduction_required_railtypes

RailTypes RailTypeInfo::introduction_required_railtypes

Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_date.

Definition at line 261 of file rail.h.

Referenced by AddDateIntroducedRailTypes(), and RailTypeChangeInfo().

◆ label

◆ maintenance_multiplier

uint16_t RailTypeInfo::maintenance_multiplier

Cost multiplier for maintenance of this rail type.

Definition at line 221 of file rail.h.

Referenced by RailTypeChangeInfo().

◆ map_colour

uint8_t RailTypeInfo::map_colour

Colour on mini-map.

Definition at line 246 of file rail.h.

Referenced by RailTypeChangeInfo().

◆ max_speed

◆ menu_text

StringID RailTypeInfo::menu_text

Name of this rail type in the main toolbar dropdown.

Definition at line 178 of file rail.h.

Referenced by GetRailTypeDropDownList(), and RailTypeChangeInfo().

◆ name

StringID RailTypeInfo::name

Name of this rail type.

Definition at line 176 of file rail.h.

Referenced by CompanyInfrastructureWindow::DrawWidget(), RailTypeChangeInfo(), and CompanyInfrastructureWindow::UpdateWidgetSize().

◆ new_loco

StringID RailTypeInfo::new_loco

Name of an engine for this type of rail in the engine preview GUI.

Definition at line 181 of file rail.h.

Referenced by GetEngineCategoryName(), and RailTypeChangeInfo().

◆ powered_railtypes

RailTypes RailTypeInfo::powered_railtypes

bitmask to the OTHER railtypes on which an engine of THIS railtype generates power

Definition at line 188 of file rail.h.

Referenced by AllocateRailType(), Train::ConsistChanged(), and RailTypeChangeInfo().

◆ rail_ew

CursorID RailTypeInfo::rail_ew

Cursor for building rail in E-W direction.

Definition at line 167 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ rail_ns

CursorID RailTypeInfo::rail_ns

Cursor for building rail in N-S direction.

Definition at line 165 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ rail_nwse

CursorID RailTypeInfo::rail_nwse

Cursor for building rail in Y direction.

Definition at line 168 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ rail_swne

CursorID RailTypeInfo::rail_swne

Cursor for building rail in X direction.

Definition at line 166 of file rail.h.

Referenced by BuildRailToolbarWindow::OnClick().

◆ replace_text

StringID RailTypeInfo::replace_text

◆ signals

SpriteID RailTypeInfo::signals[SIGTYPE_END][2][2]

signal GUI sprites (type, variant, state)

Definition at line 161 of file rail.h.

Referenced by BuildSignalWindow::DrawWidget(), and BuildSignalWindow::OnInit().

◆ single_e

SpriteID RailTypeInfo::single_e

single piece of rail in the eastern corner

Definition at line 141 of file rail.h.

Referenced by DrawTrackBits().

◆ single_n

SpriteID RailTypeInfo::single_n

single piece of rail in the northern corner

Definition at line 139 of file rail.h.

Referenced by DrawTrackBits().

◆ single_s

SpriteID RailTypeInfo::single_s

single piece of rail in the southern corner

Definition at line 140 of file rail.h.

Referenced by DrawTrackBits().

◆ single_sloped

SpriteID RailTypeInfo::single_sloped

single piece of rail for slopes

Definition at line 143 of file rail.h.

Referenced by DrawTile_TunnelBridge(), and DrawTrackBits().

◆ single_w

SpriteID RailTypeInfo::single_w

single piece of rail in the western corner

Definition at line 142 of file rail.h.

Referenced by DrawTrackBits().

◆ single_x

SpriteID RailTypeInfo::single_x

single piece of rail in X direction, without ground

Definition at line 137 of file rail.h.

Referenced by DrawBridgeMiddle(), DrawTile_Road(), DrawTile_TunnelBridge(), and DrawTrackBits().

◆ single_y

SpriteID RailTypeInfo::single_y

single piece of rail in Y direction, without ground

Definition at line 138 of file rail.h.

Referenced by DrawBridgeMiddle(), DrawTile_Road(), DrawTile_TunnelBridge(), and DrawTrackBits().

◆ snow_offset

SpriteID RailTypeInfo::snow_offset

sprite number difference between a piece of track on a snowy ground and the corresponding one on normal ground

Definition at line 185 of file rail.h.

Referenced by DrawTrackBits().

◆ sorting_order

uint8_t RailTypeInfo::sorting_order

The sorting order of this railtype for the toolbar dropdown.

Definition at line 271 of file rail.h.

Referenced by AllocateRailType(), CompareRailTypes(), and RailTypeChangeInfo().

◆ toolbar_caption

StringID RailTypeInfo::toolbar_caption

Caption in the construction toolbar GUI for this rail type.

Definition at line 177 of file rail.h.

Referenced by RailTypeChangeInfo(), and BuildRailToolbarWindow::SetStringParameters().

◆ track_ns

SpriteID RailTypeInfo::track_ns

two pieces of rail in North and South corner (East-West direction)

Definition at line 135 of file rail.h.

Referenced by DrawTrackBits().

◆ track_y

SpriteID RailTypeInfo::track_y

single piece of rail in Y direction, with ground

Definition at line 134 of file rail.h.

Referenced by DrawTrackBits().

◆ tunnel [1/2]

SpriteID RailTypeInfo::tunnel

tunnel sprites base

Definition at line 145 of file rail.h.

Referenced by DrawTile_TunnelBridge(), and BuildRailToolbarWindow::OnClick().

◆ tunnel [2/2]

CursorID RailTypeInfo::tunnel

Cursor for building a tunnel.

Definition at line 171 of file rail.h.


The documentation for this class was generated from the following file: