# RailtypeInfo Struct Reference

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

`#include <rail.h>`

## 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.
uint8 | cost_multiplier
| Cost multiplier for building this rail type.
RailTypeLabel | label
| Unique 32 bit rail type identifier.

## Detailed Description

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

Definition at line 50 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().

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 117 of file rail.h.

Referenced by DrawStationTile().

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

- src/rail.h