OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
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
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
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 piece 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
SpriteID signals [SIGTYPE_END][2][2]
| signal GUI sprites (type, variant, state)
} | 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
| Cursors associated with the rail type.
struct {
StringID name
| Name of this rail type.
StringID toolbar_caption
| Caption in the construction toolbar GUI for this rail type.
StringID menu_text
| Name of this rail type in the main toolbar dropdown.
StringID build_caption
| Caption of the build vehicle GUI for this rail type.
StringID replace_text
| Text used in the autoreplace GUI.
StringID new_loco
| Name of an engine for this type of rail in the engine preview GUI.
} | 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.
byte | fallback_railtype
| Original railtype number to use when drawing non-newgrf railtypes, or when drawing 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.
uint16 | maintenance_multiplier
| Cost multiplier for maintenance of 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.
RailTypeLabelList | alternate_labels
| Rail type labels this type provides in addition to the main label.
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 GRFFile * | grffile [RTSG_END]
| NewGRF providing the Action3 for the railtype.
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 108 of file rail.h.

## Member Function Documentation

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

References fallback_railtype.

Referenced by DrawStationTile().

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

const GRFFile* RailtypeInfo::grffile[RTSG_END]

NewGRF providing the Action3 for the railtype.

NULL if not available.

Definition at line 256 of file rail.h.

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(), BuildSignalWindow::OnInit(), and 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 235 of file rail.h.

Referenced by AddDateIntroducedRailTypes(), RailTypeChangeInfo(), and StartupEngines().

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

- src/rail.h