272 inline bool UsesOverlay()
const 300 return &_railtypes[railtype];
384 return min(upgradecost, rebuildcost);
412 return (_price[PR_INFRASTRUCTURE_RAIL] * 15 * num * (1 +
IntSqrt(num))) >> 8;
415 void DrawTrainDepotSprite(
int x,
int y,
int image,
RailType railtype);
436 extern uint8 _sorted_railtypes_size;
442 #define FOR_ALL_SORTED_RAILTYPES(var) for (uint8 index = 0; index < _sorted_railtypes_size && (var = _sorted_railtypes[index], true) ; index++) All types related to tracks.
Piece of rail on slope with north-west raised.
static bool HasPowerOnRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType got power on a tile with a given RailType.
SpriteID crossing
level crossing, rail in X direction
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
const SpriteGroup * group[RTSG_END]
Sprite groups for resolving sprites.
struct RailtypeInfo::@36 base_sprites
Struct containing the main sprites.
RailTypeFlags
Railtype flags.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
RailTypes
The different roadtypes we support, but then a bitmask of them.
const GRFFile * grffile[RTSG_END]
NewGRF providing the Action3 for the railtype.
Slope NW, Track Y, Fence NE.
static Money RailConvertCost(RailType from, RailType to)
Calculates the cost of rail conversion.
SpriteID single_sloped
single piece of rail for slopes
SpriteID auto_rail
button for the autorail construction
RailType
Enumeration for all possible railtypes.
StringID toolbar_caption
Caption in the construction toolbar GUI for this rail type.
Slope FLAT, Track Y, Fence NE.
int TicksToLeaveDepot(const Train *v)
Compute number of ticks when next wagon will leave a depot.
byte curve_speed
Multiplier for curve maximum speed advantage.
SpriteID build_y_rail
button for building single rail in Y direction
Piece of rail in southern corner.
RailTypes introduction_required_railtypes
Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_dat...
RailTypeFlags flags
Bit mask of rail type flags.
Ballast for junction 'pointing' NE.
Ballast for junction 'pointing' NW.
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
RailTypes GetCompanyRailtypes(const CompanyID c)
Get the rail types the given company can build.
Piece of rail on slope with north-east raised.
Piece of rail in western corner.
SpriteID single_e
single piece of rail in the eastern corner
RailTypeLabelList alternate_labels
Rail type labels this type provides in addition to the main label.
static Money SignalMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of signals.
Functions related to bit mathematics.
Slope FLAT, Track LOWER, Fence N.
struct RailtypeInfo::@38 cursor
Cursors associated with the rail type.
RailTypes compatible_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel ...
Slope FLAT, Track LEFT, Fence E.
CursorID autorail
Cursor for autorail tool.
static T max(const T a, const T b)
Returns the maximum of two values.
static bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
struct RailtypeInfo::@39 strings
Strings associated with the rail type.
SpriteID track_y
single piece of rail in Y direction, with ground
StringID menu_text
Name of this rail type in the main toolbar dropdown.
StringID new_loco
Name of an engine for this type of rail in the engine preview GUI.
CursorID rail_ew
Cursor for building rail in E-W direction.
StringID build_caption
Caption of the build vehicle GUI for this rail type.
This struct contains all the info that is needed to draw and construct tracks.
SpriteID signals[SIGTYPE_END][2][2]
signal GUI sprites (type, variant, state)
RailFenceOffset
Offsets from base sprite for fence sprites.
SpriteID single_y
single piece of rail in Y direction, without ground
TrackBits
Bitfield corresponding to Track.
CursorID tunnel
Cursor for building a tunnel.
Types and classes related to signals.
Foundation
Enumeration for Foundations.
SpriteID ground
ground sprite for a 3-way switch
RailType AllocateRailType(RailTypeLabel label)
Allocate a new rail type label.
Sloped rail pieces, in order NE, SE, SW, NW.
Piece of rail in X direction.
Level crossing overlay images.
Images for overlaying track.
Slope SE, Track Y, Fence SW.
Slope FLAT, Track UPPER, Fence S.
Piece of rail on slope with south-west raised.
Piece of rail in X direction.
SpriteID build_ns_rail
button for building single rail in N-S direction
uint8 acceleration_type
Acceleration type of this rail type.
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.
Value for drawing a catenary.
Slope SW, Track X, Fence NW.
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
SpriteID single_w
single piece of rail in the western corner
Foundation GetRailFoundation(Slope tileh, TrackBits bits)
Checks if a track combination is valid on a specific slope and returns the needed foundation...
bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
Finds out if a company has a certain railtype available.
CursorID rail_nwse
Cursor for building rail in Y direction.
Bit number for drawing a catenary.
Crossing of X and Y rail, with ballast.
SpriteID single_x
single piece of rail in X direction, without ground
SpriteID convert_rail
button for converting rail
static Money RailClearCost(RailType railtype)
Returns the 'cost' of clearing the specified railtype.
RailTrackBridgeOffset
Offsets for sprites within a bridge surface overlay set.
static T min(const T a, const T b)
Returns the minimum of two values.
RailTypeLabel label
Unique 32 bit rail type identifier.
Piece of rail in Y direction.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Piece of rail on slope with south-east raised.
Piece of rail in Y direction.
Slope FLAT, Track X, Fence SE.
SpriteID single_n
single piece of rail in the northern corner
Piece of rail in eastern corner.
SpriteID single_s
single piece of rail in the southern corner
Piece of rail in northern corner.
StringID replace_text
Text used in the autoreplace GUI.
Slope NE, Track X, Fence NW.
SpriteID build_depot
button for building depots
'Train' is either a loco or a wagon.
CursorID depot
Cursor for building a depot.
CursorID convert
Cursor for converting track.
Date introduction_date
Introduction date.
uint16 cost_multiplier
Cost multiplier for building this rail type.
RailTypeSpriteGroup
Sprite groups for a railtype.
RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date)
Add the rail types that are to be introduced at the given date.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
CursorID rail_swne
Cursor for building rail in X direction.
Slope FLAT, Track RIGHT, Fence W.
byte fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations...
static Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
Functions related to the economy.
Value for disallowing level crossings.
Cursor and toolbar icon images.
byte map_colour
Colour on mini-map.
void InitRailTypes()
Resolve sprites of custom rail types.
Slope
Enumeration for the slope-type.
SpriteID build_tunnel
button for building a tunnel
Ballast for junction 'pointing' SE.
Ballast for junction 'pointing' SW.
Main group of ground images.
Slope SE, Track Y, Fence NE.
static bool IsCompatibleRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType can drive on a tile with a given RailType.
RailTypes powered_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype generates power ...
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
void ResetRailTypes()
Reset all rail type information to its default values.
uint32 CursorID
The number of the cursor (sprite)
struct RailtypeInfo::@37 gui_sprites
struct containing the sprites for the rail GUI.
SmallVector< RailTypeLabel, 4 > RailTypeLabelList
List of rail type labels.
Slope SW, Track X, Fence SE.
RailType GetBestRailtype(const CompanyID company)
Returns the "best" railtype a company can build.
SpriteID bridge_offset
Bridge offset.
Types related to strings.
Types related to the dates in OpenTTD.
int32 Date
The type to store our dates in.
StringID name
Name of this rail type.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
uint32 IntSqrt(uint32 num)
Compute the integer square root.
SpriteID tunnel
tunnel sprites base
CursorID rail_ns
Cursor for building rail in N-S direction.
Slope NE, Track X, Fence SE.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Main group of ground images for snow or desert.
SpriteID track_ns
two pieces of rail in North and South corner (East-West direction)
Ballast for full junction.
Slope FLAT, Track X, Fence NW.
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels=true)
Get the rail type for a given label.
Owner
Enum for all companies/owners.
SpriteID build_x_rail
button for building single rail in X direction
Slope NW, Track Y, Fence SW.
static Money RailMaintenanceCost(RailType railtype, uint32 num, uint32 total_num)
Calculates the maintenance cost of a number of track bits.
SpriteID build_ew_rail
button for building single rail in E-W direction
Bit number for disallowing level crossings.
Types related to the graphics and/or input devices.
Slope FLAT, Track Y, Fence SW.
SpriteID snow_offset
sprite number difference between a piece of track on a snowy ground and the corresponding one on norm...
Dynamic data of a loaded NewGRF.
uint16 maintenance_multiplier
Cost multiplier for maintenance of this rail type.
The different types of rail.