OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
280 inline bool UsesOverlay()
const
308 return &_railtypes[railtype];
364 return rt1_90deg || rt2_90deg;
375 return (_price[PR_BUILD_RAIL] *
GetRailTypeInfo(railtype)->cost_multiplier) >> 3;
391 return std::max(_price[PR_CLEAR_RAIL], -
RailBuildCost(railtype) * 3 / 4);
412 return std::min(upgradecost, rebuildcost);
430 return (_price[PR_INFRASTRUCTURE_RAIL] *
GetRailTypeInfo(railtype)->maintenance_multiplier * num * (1 +
IntSqrt(total_num))) >> 11;
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++)
struct RailtypeInfo::@39 gui_sprites
struct containing the sprites for the rail GUI.
CursorID rail_nwse
Cursor for building rail in Y direction.
static bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
@ RTO_JUNCTION_SE
Ballast for junction 'pointing' SE.
SpriteID track_ns
two pieces of rail in North and South corner (East-West direction)
@ RTO_W
Piece of rail in western corner.
SpriteID single_x
single piece of rail in X direction, without ground
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
static Money SignalMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of signals.
@ 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.
StringID menu_text
Name of this rail type in the main toolbar dropdown.
SpriteID single_n
single piece of rail in the northern corner
bool forbid_90_deg
forbid trains to make 90 deg turns
SpriteID build_depot
button for building depots
CursorID convert
Cursor for converting track.
@ RTSG_CROSSING
Level crossing overlay images.
StringID replace_text
Text used in the autoreplace GUI.
@ RTSG_PYLONS
Catenary pylons.
std::vector< RailTypeLabel > RailTypeLabelList
List of rail type labels.
@ RTSG_SIGNALS
Signal images.
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 single_y
single piece of rail in Y direction, without ground
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
CursorID rail_swne
Cursor for building rail in X direction.
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 tunnel
Cursor for building a tunnel.
const GRFFile * grffile[RTSG_END]
NewGRF providing the Action3 for the railtype.
SpriteID build_tunnel
button for building a tunnel
CursorID depot
Cursor for building a depot.
SpriteID single_sloped
single piece of rail for slopes
uint32 IntSqrt(uint32 num)
Compute the integer square root.
SpriteID auto_rail
button for the autorail construction
RailTypes GetCompanyRailtypes(CompanyID company, bool introduces=true)
Get the rail types the given company can build.
bool HasAnyRailtypesAvail(const CompanyID company)
Test if any buildable railtype is available for a company.
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.
@ RFO_SLOPE_SW_NW
Slope SW, Track X, Fence NW.
byte fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.
SpriteID build_ns_rail
button for building single rail in N-S direction
@ RTFB_HIDDEN
Value for hiding from selection.
Owner
Enum for all companies/owners.
static Money RailClearCost(RailType railtype)
Returns the 'cost' of clearing the specified railtype.
@ RFO_SLOPE_SE_SW
Slope SE, Track Y, Fence SW.
RailTrackBridgeOffset
Offsets for sprites within a bridge surface overlay set.
Foundation
Enumeration for Foundations.
byte sorting_order
The sorting order of this railtype for the toolbar dropdown.
RailTypeSpriteGroup
Sprite groups for a railtype.
@ RTO_JUNCTION_NE
Ballast for junction 'pointing' NE.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
@ RTO_SLOPE_NE
Piece of rail on slope with north-east raised.
RailTypes introduction_required_railtypes
Bitmask of railtypes that are required for this railtype to be introduced at a given introduction_dat...
StringID name
Name of this rail type.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
SpriteID build_x_rail
button for building single rail in X direction
CursorID rail_ns
Cursor for building rail in N-S direction.
@ RTFB_CATENARY
Value for drawing a catenary.
@ RTBO_Y
Piece of rail in Y direction.
PathfinderSettings pf
settings for all pathfinders
@ RTO_N
Piece of rail in northern corner.
SpriteID single_w
single piece of rail in the western corner
RailType
Enumeration for all possible railtypes.
SpriteID tunnel
tunnel sprites base
@ RTF_CATENARY
Bit number for drawing a catenary.
@ RTSG_GROUND_COMPLETE
Complete ground images.
uint32 CursorID
The number of the cursor (sprite)
@ RTF_HIDDEN
Bit number for hiding from selection.
@ RTSG_BRIDGE
Bridge surface images.
RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date)
Add the rail types that are to be introduced at the given date.
@ RTO_CROSSING_XY
Crossing of X and Y rail, with ballast.
@ RTFB_DISALLOW_90DEG
Value for never allowed 90 degree turns, regardless of setting.
RailTypeLabelList alternate_labels
Rail type labels this type provides in addition to the main label.
SpriteID snow_offset
sprite number difference between a piece of track on a snowy ground and the corresponding one on norm...
@ RTF_DISALLOW_90DEG
Bit number for never allowed 90 degree turns, regardless of setting.
SpriteID track_y
single piece of rail in Y direction, with ground
@ RTO_SLOPE_SE
Piece of rail on slope with south-east raised.
@ RTSG_FENCES
Fence images.
static Money RailConvertCost(RailType from, RailType to)
Calculates the cost of rail conversion.
int32 Date
The type to store our dates in.
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
Date introduction_date
Introduction date.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
CursorID autorail
Cursor for autorail tool.
@ RFO_SLOPE_NE_NW
Slope NE, Track X, Fence NW.
static Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
@ RTSG_CURSORS
Cursor and toolbar icon images.
@ RTFB_ALLOW_90DEG
Value for always allowed 90 degree turns, regardless of setting.
'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.
@ RFO_FLAT_LEFT
Slope FLAT, Track LEFT, Fence E.
@ RTSG_GROUND
Main group of ground images.
static Money RailMaintenanceCost(RailType railtype, uint32 num, uint32 total_num)
Calculates the maintenance cost of a number of track bits.
Slope
Enumeration for the slope-type.
@ RTBO_SLOPE
Sloped rail pieces, in order NE, SE, SW, NW.
struct RailtypeInfo::@38 base_sprites
Struct containing the main sprites.
StringID toolbar_caption
Caption in the construction toolbar GUI for this rail type.
@ RTSG_OVERLAY
Images for overlaying track.
RailTypes powered_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype generates power
byte map_colour
Colour on mini-map.
@ RTSG_TUNNEL
Main group of ground images for snow or desert.
@ RTFB_NO_SPRITE_COMBINE
Value for using non-combined junctions.
uint8 acceleration_type
Acceleration type of this rail type.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ RFO_FLAT_X_NW
Slope FLAT, Track X, Fence NW.
@ RFO_SLOPE_SE_NE
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.
RailType AllocateRailType(RailTypeLabel label)
Allocate a new rail type label.
@ RTSG_WIRES
Catenary wires.
RailTypeFlags flags
Bit mask of rail type flags.
struct RailtypeInfo::@40 cursor
Cursors associated with the rail type.
@ RTBO_X
Piece of rail in X direction.
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.
@ RFO_SLOPE_NE_SE
Slope NE, Track X, Fence SE.
@ RTO_X
Piece of rail in X direction.
@ RTSG_DEPOT
Depot images.
@ RTO_JUNCTION_NSEW
Ballast for full junction.
RailTypeFlags
Railtype flags.
RailTypeLabel label
Unique 32 bit rail type identifier.
@ RTF_ALLOW_90DEG
Bit number for always allowed 90 degree turns, regardless of setting.
@ RTFB_NONE
All flags cleared.
RailTypes GetRailTypes(bool introduces)
Get list of rail types, regardless of company availability.
@ RTO_Y
Piece of rail in Y direction.
StringID build_caption
Caption of the build vehicle GUI for this rail type.
SpriteID single_e
single piece of rail in the eastern corner
@ RTO_SLOPE_NW
Piece of rail on slope with north-west raised.
@ RTO_E
Piece of rail in eastern corner.
struct RailtypeInfo::@41 strings
Strings associated with the rail type.
@ RTF_NO_SPRITE_COMBINE
Bit number for using non-combined junctions.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
SpriteID build_ew_rail
button for building single rail in E-W direction
TrackBits
Bitfield corresponding to Track.
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.
@ RTF_NO_LEVEL_CROSSING
Bit number for disallowing level crossings.
StringID new_loco
Name of an engine for this type of rail in the engine preview GUI.
RailTypes compatible_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel
bool HasRailtypeAvail(const CompanyID company, const RailType railtype)
Finds out if a company has a certain buildable railtype available.
SpriteID single_s
single piece of rail in the southern corner
@ RFO_FLAT_Y_SW
Slope FLAT, Track Y, Fence SW.
uint16 maintenance_multiplier
Cost multiplier for maintenance of this rail type.
@ 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
const SpriteGroup * group[RTSG_END]
Sprite groups for resolving sprites.
CursorID rail_ew
Cursor for building rail in E-W direction.
uint16 cost_multiplier
Cost multiplier for building this rail type.
SpriteID build_y_rail
button for building single rail in Y direction
SpriteID signals[SIGTYPE_END][2][2]
signal GUI sprites (type, variant, state)
RailTypes
The different railtypes we support, but then a bitmask of them.
void InitRailTypes()
Resolve sprites of custom rail types.
@ RTO_JUNCTION_SW
Ballast for junction 'pointing' SW.
@ RFO_FLAT_Y_NE
Slope FLAT, Track Y, Fence NE.
byte curve_speed
Multiplier for curve maximum speed advantage.
SpriteID ground
ground sprite for a 3-way switch
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
Dynamic data of a loaded NewGRF.
@ RFO_FLAT_LOWER
Slope FLAT, Track LOWER, Fence N.
SpriteID bridge_offset
Bridge offset.
SpriteID convert_rail
button for converting rail
@ INVALID_RAILTYPE
Flag for invalid railtype.
@ RTFB_NO_LEVEL_CROSSING
Value for disallowing level crossings.
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced.
@ RTSG_TUNNEL_PORTAL
Tunnel portal overlay.
@ RTO_JUNCTION_NW
Ballast for junction 'pointing' NW.