283 inline bool UsesOverlay()
const
311 return &_railtypes[railtype];
367 return rt1_90deg || rt2_90deg;
378 return (_price[PR_BUILD_RAIL] *
GetRailTypeInfo(railtype)->cost_multiplier) >> 3;
394 return std::max(_price[PR_CLEAR_RAIL], -
RailBuildCost(railtype) * 3 / 4);
415 return std::min(upgradecost, rebuildcost);
433 return (_price[PR_INFRASTRUCTURE_RAIL] *
GetRailTypeInfo(railtype)->maintenance_multiplier * num * (1 +
IntSqrt(total_num))) >> 11;
443 return (_price[PR_INFRASTRUCTURE_RAIL] * 15 * num * (1 +
IntSqrt(num))) >> 8;
446 void DrawTrainDepotSprite(
int x,
int y,
int image,
RailType railtype);
467 extern std::vector<RailType> _sorted_railtypes;
Functions related to bit mathematics.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
This struct contains all the info that is needed to draw and construct tracks.
SpriteID single_x
single piece of rail in X direction, without ground
struct RailTypeInfo::@25 cursor
Cursors associated with the rail type.
SpriteID bridge_offset
Bridge offset.
uint16_t max_speed
Maximum speed for vehicles travelling on this rail type.
SpriteID build_tunnel
button for building a tunnel
CursorID rail_swne
Cursor for building rail in X direction.
SpriteID convert_rail
button for converting rail
CursorID convert
Cursor for converting track.
struct RailTypeInfo::@23 base_sprites
Struct containing the main sprites.
CursorID depot
Cursor for building a depot.
TimerGameCalendar::Date introduction_date
Introduction date.
struct RailTypeInfo::@26 strings
Strings associated with the rail type.
RailTypes powered_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype generates power
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced.
SpriteID ground
ground sprite for a 3-way switch
CursorID rail_nwse
Cursor for building rail in Y direction.
RailTypes introduction_required_railtypes
Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_dat...
SpriteID build_x_rail
button for building single rail in X direction
uint8_t sorting_order
The sorting order of this railtype for the toolbar dropdown.
RailTypeLabel label
Unique 32 bit rail type identifier.
SpriteID single_n
single piece of rail in the northern corner
CursorID tunnel
Cursor for building a tunnel.
uint16_t maintenance_multiplier
Cost multiplier for maintenance of this rail type.
SpriteID crossing
level crossing, rail in X direction
const SpriteGroup * group[RTSG_END]
Sprite groups for resolving sprites.
uint8_t map_colour
Colour on mini-map.
CursorID rail_ew
Cursor for building rail in E-W direction.
SpriteID auto_rail
button for the autorail construction
CursorID autorail
Cursor for autorail tool.
SpriteID single_y
single piece of rail in Y direction, without ground
StringID menu_text
Name of this rail type in the main toolbar dropdown.
StringID name
Name of this rail type.
RailTypes compatible_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel
uint8_t fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
StringID toolbar_caption
Caption in the construction toolbar GUI for this rail type.
SpriteID single_s
single piece of rail in the southern corner
RailTypeFlags flags
Bit mask of rail type flags.
uint8_t curve_speed
Multiplier for curve maximum speed advantage.
SpriteID signals[SIGTYPE_END][2][2]
signal GUI sprites (type, variant, state)
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
uint16_t cost_multiplier
Cost multiplier for building this rail type.
SpriteID track_ns
two pieces of rail in North and South corner (East-West direction)
StringID replace_text
Text used in the autoreplace GUI.
RailTypeLabelList alternate_labels
Rail type labels this type provides in addition to the main label.
StringID build_caption
Caption of the build vehicle GUI for this rail type.
SpriteID snow_offset
sprite number difference between a piece of track on a snowy ground and the corresponding one on norm...
SpriteID track_y
single piece of rail in Y direction, with ground
SpriteID build_depot
button for building depots
struct RailTypeInfo::@24 gui_sprites
struct containing the sprites for the rail GUI.
SpriteID single_w
single piece of rail in the western corner
SpriteID single_e
single piece of rail in the eastern corner
SpriteID build_ns_rail
button for building single rail in N-S direction
CursorID rail_ns
Cursor for building rail in N-S direction.
StringID new_loco
Name of an engine for this type of rail in the engine preview GUI.
const GRFFile * grffile[RTSG_END]
NewGRF providing the Action3 for the railtype.
SpriteID tunnel
tunnel sprites base
SpriteID single_sloped
single piece of rail for slopes
uint8_t acceleration_type
Acceleration type of this rail type.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Owner
Enum for all companies/owners.
uint32_t IntSqrt(uint32_t num)
Compute the integer square root.
Functions related to the economy.
Types related to the graphics and/or input devices.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
uint32_t CursorID
The number of the cursor (sprite)
Money RailConvertCost(RailType from, RailType to)
Calculates the cost of rail conversion.
int TicksToLeaveDepot(const Train *v)
Compute number of ticks when next wagon will leave a depot.
RailTypeSpriteGroup
Sprite groups for a railtype.
@ RTSG_GROUND
Main group of ground images.
@ RTSG_PYLONS
Catenary pylons.
@ RTSG_CURSORS
Cursor and toolbar icon images.
@ RTSG_GROUND_COMPLETE
Complete ground images.
@ RTSG_CROSSING
Level crossing overlay images.
@ RTSG_TUNNEL
Main group of ground images for snow or desert.
@ RTSG_WIRES
Catenary wires.
@ RTSG_OVERLAY
Images for overlaying track.
@ RTSG_SIGNALS
Signal images.
@ RTSG_DEPOT
Depot images.
@ RTSG_BRIDGE
Bridge surface images.
@ RTSG_TUNNEL_PORTAL
Tunnel portal overlay.
@ RTSG_FENCES
Fence images.
RailTrackBridgeOffset
Offsets for sprites within a bridge surface overlay set.
@ RTBO_Y
Piece of rail in Y direction.
@ RTBO_X
Piece of rail in X direction.
@ RTBO_SLOPE
Sloped rail pieces, in order NE, SE, SW, NW.
Money RailClearCost(RailType railtype)
Returns the 'cost' of clearing the specified railtype.
Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
RailType AllocateRailType(RailTypeLabel label)
Allocate a new rail type label.
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
bool HasAnyRailTypesAvail(const CompanyID company)
Test if any buildable railtype is available for a company.
Money RailMaintenanceCost(RailType railtype, uint32_t num, uint32_t total_num)
Calculates the maintenance cost of a number of track bits.
bool HasRailTypeAvail(const CompanyID company, const RailType railtype)
Finds out if a company has a certain buildable railtype available.
bool IsCompatibleRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType can drive on a tile with a given RailType.
void InitRailTypes()
Resolve sprites of custom rail types.
bool HasPowerOnRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType got power on a tile with a given RailType.
std::vector< RailTypeLabel > RailTypeLabelList
List of rail type labels.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
@ RTO_Y
Piece of rail in Y direction.
@ RTO_S
Piece of rail in southern corner.
@ RTO_JUNCTION_NE
Ballast for junction 'pointing' NE.
@ RTO_JUNCTION_NSEW
Ballast for full junction.
@ RTO_JUNCTION_SW
Ballast for junction 'pointing' SW.
@ RTO_SLOPE_SE
Piece of rail on slope with south-east raised.
@ RTO_E
Piece of rail in eastern corner.
@ RTO_W
Piece of rail in western corner.
@ RTO_CROSSING_XY
Crossing of X and Y rail, with ballast.
@ RTO_SLOPE_SW
Piece of rail on slope with south-west raised.
@ RTO_SLOPE_NW
Piece of rail on slope with north-west raised.
@ RTO_JUNCTION_NW
Ballast for junction 'pointing' NW.
@ RTO_JUNCTION_SE
Ballast for junction 'pointing' SE.
@ RTO_SLOPE_NE
Piece of rail on slope with north-east raised.
@ RTO_X
Piece of rail in X direction.
@ RTO_N
Piece of rail in northern corner.
RailTypes AddDateIntroducedRailTypes(RailTypes current, TimerGameCalendar::Date date)
Add the rail types that are to be introduced at the given date.
void ResetRailTypes()
Reset all rail type information to its default values.
Money SignalMaintenanceCost(uint32_t num)
Calculates the maintenance cost of a number of signals.
bool Rail90DegTurnDisallowed(RailType rt1, RailType rt2, bool def=_settings_game.pf.forbid_90_deg)
Test if 90 degree turns are disallowed between two railtypes.
RailTypes GetCompanyRailTypes(CompanyID company, bool introduces=true)
Get the rail types the given company can build.
RailFenceOffset
Offsets from base sprite for fence sprites.
@ RFO_FLAT_RIGHT
Slope FLAT, Track RIGHT, Fence W.
@ RFO_FLAT_Y_NE
Slope FLAT, Track Y, Fence NE.
@ RFO_SLOPE_NW_SW
Slope NW, Track Y, Fence SW.
@ RFO_FLAT_X_SE
Slope FLAT, Track X, Fence SE.
@ RFO_SLOPE_NW_NE
Slope NW, Track Y, Fence NE.
@ RFO_SLOPE_SE_SW
Slope SE, Track Y, Fence SW.
@ RFO_SLOPE_NE_SE
Slope NE, Track X, Fence SE.
@ RFO_FLAT_LOWER
Slope FLAT, Track LOWER, Fence N.
@ RFO_SLOPE_SW_SE
Slope SW, Track X, Fence SE.
@ RFO_FLAT_UPPER
Slope FLAT, Track UPPER, Fence S.
@ RFO_SLOPE_SE_NE
Slope SE, Track Y, Fence NE.
@ RFO_FLAT_Y_SW
Slope FLAT, Track Y, Fence SW.
@ RFO_FLAT_LEFT
Slope FLAT, Track LEFT, Fence E.
@ RFO_SLOPE_NE_NW
Slope NE, Track X, Fence NW.
@ RFO_FLAT_X_NW
Slope FLAT, Track X, Fence NW.
@ RFO_SLOPE_SW_NW
Slope SW, Track X, Fence NW.
RailTypeFlag
Railtype flag bit numbers.
@ RTF_NO_LEVEL_CROSSING
Bit number for disallowing level crossings.
@ RTF_HIDDEN
Bit number for hiding from selection.
@ RTF_NO_SPRITE_COMBINE
Bit number for using non-combined junctions.
@ RTF_ALLOW_90DEG
Bit number for always allowed 90 degree turns, regardless of setting.
@ RTF_DISALLOW_90DEG
Bit number for never allowed 90 degree turns, regardless of setting.
@ RTF_CATENARY
Bit number for drawing a catenary.
RailTypes GetRailTypes(bool introduces)
Get list of rail types, regardless of company availability.
Foundation GetRailFoundation(Slope tileh, TrackBits bits)
Checks if a track combination is valid on a specific slope and returns the needed foundation.
bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
RailTypeFlags
Railtype flags.
@ RTFB_NO_LEVEL_CROSSING
Value for disallowing level crossings.
@ RTFB_ALLOW_90DEG
Value for always allowed 90 degree turns, regardless of setting.
@ RTFB_DISALLOW_90DEG
Value for never allowed 90 degree turns, regardless of setting.
@ RTFB_NO_SPRITE_COMBINE
Value for using non-combined junctions.
@ RTFB_CATENARY
Value for drawing a catenary.
@ RTFB_NONE
All flags cleared.
@ RTFB_HIDDEN
Value for hiding from selection.
RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels=true)
Get the rail type for a given label.
bool ValParamRailType(const RailType rail)
Validate functions for rail building.
The different types of rail.
RailTypes
Allow incrementing of Track variables.
RailType
Enumeration for all possible railtypes.
@ RAILTYPE_END
Used for iterations.
@ INVALID_RAILTYPE
Flag for invalid railtype.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Types related to global configuration settings.
Types and classes related to signals.
Slope
Enumeration for the slope-type.
Foundation
Enumeration for Foundations.
Types related to strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Dynamic data of a loaded NewGRF.
PathfinderSettings pf
settings for all pathfinders
bool forbid_90_deg
forbid trains to make 90 deg turns
Templated helper to make a type-safe 'typedef' representing a single POD value.
'Train' is either a loco or a wagon.
Definition of the game-calendar-timer.
All types related to tracks.
TrackBits
Allow incrementing of Track variables.