OpenTTD Source  20241120-master-g6d3adc6169
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. More...
 

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

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_TunnelBridge().

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

◆ 

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

◆ 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().


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