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