# RailtypeInfo Struct 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
## Data Fields
struct {
SpriteID track_y
| single piece of rail in Y direction, with ground
SpriteID track_ns
| two pieces of rail in North and South corner (East-West direction)
SpriteID ground
| ground sprite for a 3-way switch
SpriteID single_x
| single piece of rail in X direction, without ground
SpriteID single_y
| single piece of rail in Y direction, without ground
SpriteID single_n
| single piece of rail in the northern corner
SpriteID single_s
| single piece of rail in the southern corner
SpriteID single_e
| single piece of rail in the eastern corner
SpriteID single_w
| single piece of rail in the western corner
SpriteID single_sloped
| single piecs of rail for slopes
SpriteID crossing
| level crossing, rail in X direction
SpriteID tunnel
| tunnel sprites base
} | base_sprites
| Struct containing the main sprites.
struct {
SpriteID build_ns_rail
| button for building single rail in N-S direction
SpriteID build_x_rail
| button for building single rail in X direction
SpriteID build_ew_rail
| button for building single rail in E-W direction
SpriteID build_y_rail
| button for building single rail in Y direction
SpriteID auto_rail
| button for the autorail construction
SpriteID build_depot
| button for building depots
SpriteID build_tunnel
| button for building a tunnel
SpriteID convert_rail
| button for converting rail
} | gui_sprites
| struct containing the sprites for the rail GUI.
struct {
CursorID rail_ns
| Cursor for building rail in N-S direction.
CursorID rail_swne
| Cursor for building rail in X direction.
CursorID rail_ew
| Cursor for building rail in E-W direction.
CursorID rail_nwse
| Cursor for building rail in Y direction.
CursorID autorail
| Cursor for autorail tool.
CursorID depot
| Cursor for building a depot.
CursorID tunnel
| Cursor for building a tunnel.
CursorID convert
| Cursor for converting track.
} | cursor
struct {
StringID toolbar_caption
StringID menu_text
StringID build_caption
StringID replace_text
StringID new_loco
} | strings
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 | total_offset
| Offset between the current railtype and normal rail.
SpriteID | bridge_offset
| Bridge offset.
byte | custom_ground_offset
| Offset to add to ground sprite when drawing custom waypoints / stations.
byte | curve_speed
| Multiplier for curve maximum speed advantage.
RailTypeFlags | flags
| Bit mask of rail type flags.
uint16 | cost_multiplier
| Cost multiplier for building this rail type.
uint8 | acceleration_type
| Acceleration type of this rail type.
uint16 | max_speed
| Maximum speed for vehicles travelling on this rail type.
RailTypeLabel | label
| Unique 32 bit rail type identifier.
byte | map_colour
| Colour on mini-map.
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.
byte | sorting_order
| The sorting order of this railtype for the toolbar dropdown.
const SpriteGroup * | group [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 102 of file rail.h.

## Field Documentation

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 DrawTile_Road(), DrawTile_TunnelBridge(), and DrawTrackBits().

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 BuildRailToolbarWindow::SetupRailToolbar().

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_types.

Definition at line 227 of file rail.h.

Referenced by AddDateIntroducedRailTypes().

SpriteID RailtypeInfo::total_offset

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.

Note:
  : Something more flexible might be desirable in the future.

Definition at line 173 of file rail.h.

Referenced by DrawStationTile().

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

- src/rail.h