280 inline bool UsesOverlay()
const 308 return &_railtypes[railtype];
364 return rt1_90deg || rt2_90deg;
412 return min(upgradecost, rebuildcost);
440 return (_price[PR_INFRASTRUCTURE_RAIL] * 15 * num * (1 +
IntSqrt(num))) >> 8;
443 void DrawTrainDepotSprite(
int x,
int y,
int image,
RailType railtype);
464 extern std::vector<RailType> _sorted_railtypes;
471 #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.
Owner
Enum for all companies/owners.
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.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
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
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.
Flag for invalid railtype.
Ballast for junction 'pointing' NW.
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
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
PathfinderSettings pf
settings for all pathfinders
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.
bool forbid_90_deg
forbid trains to make 90 deg turns
RailTypes compatible_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel ...
Value for never allowed 90 degree turns, regardless of setting.
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.
Value for always allowed 90 degree turns, regardless of setting.
SpriteID single_y
single piece of rail in Y direction, without ground
CursorID tunnel
Cursor for building a tunnel.
Value for using non-combined junctions.
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.
Types related to global configuration settings.
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.
Bit number for using non-combined junctions.
TrackBits
Bitfield corresponding to Track.
RailTypes GetCompanyRailtypes(CompanyID company, bool introduces=true)
Get the rail types the given company can build.
Value for hiding from selection.
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 buildable 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.
RailTypes
The different railtypes we support, but then a bitmask of them.
RailTypes GetRailTypes(bool introduces)
Get list of rail types, regardless of company availability.
Piece of rail in Y direction.
Bit number for never allowed 90 degree turns, regardless of setting.
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.
Bit number for hiding from selection.
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.
RailType
Enumeration for all possible railtypes.
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.
Slope SW, Track X, Fence SE.
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.
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
static bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def=_settings_game.pf.forbid_90_deg)
Test if 90 degree turns are disallowed between two railtypes.
Bit number for disallowing level crossings.
bool HasAnyRailtypesAvail(const CompanyID company)
Test if any buildable railtype is available for a company.
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...
Bit number for always allowed 90 degree turns, regardless of setting.
std::vector< RailTypeLabel > RailTypeLabelList
List of rail type labels.
Dynamic data of a loaded NewGRF.
uint16 maintenance_multiplier
Cost multiplier for maintenance of this rail type.
The different types of rail.