OpenTTD
|
Hides the direct accesses to the map array with map accessors. More...
#include "rail_type.h"
#include "depot_type.h"
#include "signal_func.h"
#include "track_func.h"
#include "tile_map.h"
#include "signal_type.h"
Go to the source code of this file.
Enumerations | |
enum | RailTileType { RAIL_TILE_NORMAL = 0, RAIL_TILE_SIGNALS = 1, RAIL_TILE_DEPOT = 3 } |
Different types of Rail-related tiles. More... | |
enum | RailGroundType { RAIL_GROUND_BARREN = 0, RAIL_GROUND_GRASS = 1, RAIL_GROUND_FENCE_NW = 2, RAIL_GROUND_FENCE_SE = 3, RAIL_GROUND_FENCE_SENW = 4, RAIL_GROUND_FENCE_NE = 5, RAIL_GROUND_FENCE_SW = 6, RAIL_GROUND_FENCE_NESW = 7, RAIL_GROUND_FENCE_VERT1 = 8, RAIL_GROUND_FENCE_VERT2 = 9, RAIL_GROUND_FENCE_HORIZ1 = 10, RAIL_GROUND_FENCE_HORIZ2 = 11, RAIL_GROUND_ICE_DESERT = 12, RAIL_GROUND_WATER = 13, RAIL_GROUND_HALF_SNOW = 14 } |
The ground 'under' the rail. More... |
Functions | |
static RailTileType | GetRailTileType (TileIndex t) |
Returns the RailTileType (normal with or without signals, waypoint or depot). | |
static bool | IsPlainRail (TileIndex t) |
Returns whether this is plain rails, with or without signals. | |
static bool | IsPlainRailTile (TileIndex t) |
Checks whether the tile is a rail tile or rail tile with signals. | |
static bool | HasSignals (TileIndex t) |
Checks if a rail tile has signals. | |
static void | SetHasSignals (TileIndex tile, bool signals) |
Add/remove the 'has signal' bit from the RailTileType. | |
static bool | IsRailDepot (TileIndex t) |
Is this rail tile a rail depot? | |
static bool | IsRailDepotTile (TileIndex t) |
Is this tile rail tile and a rail depot? | |
static RailType | GetRailType (TileIndex t) |
Gets the rail type of the given tile. | |
static void | SetRailType (TileIndex t, RailType r) |
Sets the rail type of the given tile. | |
static TrackBits | GetTrackBits (TileIndex tile) |
Gets the track bits of the given tile. | |
static void | SetTrackBits (TileIndex t, TrackBits b) |
Sets the track bits of the given tile. | |
static bool | HasTrack (TileIndex tile, Track track) |
Returns whether the given track is present on the given tile. | |
static DiagDirection | GetRailDepotDirection (TileIndex t) |
Returns the direction the depot is facing to. | |
static Track | GetRailDepotTrack (TileIndex t) |
Returns the track of a depot, ignoring direction. | |
static TrackBits | GetRailReservationTrackBits (TileIndex t) |
Returns the reserved track bits of the tile. | |
static void | SetTrackReservation (TileIndex t, TrackBits b) |
Sets the reserved track bits of the tile. | |
static bool | TryReserveTrack (TileIndex tile, Track t) |
Try to reserve a specific track on a tile. | |
static void | UnreserveTrack (TileIndex tile, Track t) |
Lift the reservation of a specific track on a tile. | |
static bool | HasDepotReservation (TileIndex t) |
Get the reservation state of the depot. | |
static void | SetDepotReservation (TileIndex t, bool b) |
Set the reservation state of the depot. | |
static TrackBits | GetDepotReservationTrackBits (TileIndex t) |
Get the reserved track bits for a depot. | |
static bool | IsPbsSignal (SignalType s) |
static SignalType | GetSignalType (TileIndex t, Track track) |
static void | SetSignalType (TileIndex t, Track track, SignalType s) |
static bool | IsPresignalEntry (TileIndex t, Track track) |
static bool | IsPresignalExit (TileIndex t, Track track) |
static bool | IsOnewaySignal (TileIndex t, Track track) |
One-way signals can't be passed the 'wrong' way. | |
static void | CycleSignalSide (TileIndex t, Track track) |
static SignalVariant | GetSignalVariant (TileIndex t, Track track) |
static void | SetSignalVariant (TileIndex t, Track track, SignalVariant v) |
static void | SetSignalStates (TileIndex tile, uint state) |
Set the states of the signals (Along/AgainstTrackDir) | |
static uint | GetSignalStates (TileIndex tile) |
Set the states of the signals (Along/AgainstTrackDir) | |
static SignalState | GetSingleSignalState (TileIndex t, byte signalbit) |
Get the state of a single signal. | |
static void | SetPresentSignals (TileIndex tile, uint signals) |
Set whether the given signals are present (Along/AgainstTrackDir) | |
static uint | GetPresentSignals (TileIndex tile) |
Get whether the given signals are present (Along/AgainstTrackDir) | |
static bool | IsSignalPresent (TileIndex t, byte signalbit) |
Checks whether the given signals is present. | |
static bool | HasSignalOnTrack (TileIndex tile, Track track) |
Checks for the presence of signals (either way) on the given track on the given rail tile. | |
static bool | HasSignalOnTrackdir (TileIndex tile, Trackdir trackdir) |
Checks for the presence of signals along the given trackdir on the given rail tile. | |
static SignalState | GetSignalStateByTrackdir (TileIndex tile, Trackdir trackdir) |
Gets the state of the signal along the given trackdir. | |
static void | SetSignalStateByTrackdir (TileIndex tile, Trackdir trackdir, SignalState state) |
Sets the state of the signal along the given trackdir. | |
static bool | HasPbsSignalOnTrackdir (TileIndex tile, Trackdir td) |
Is a pbs signal present along the trackdir? | |
static bool | HasOnewaySignalBlockingTrackdir (TileIndex tile, Trackdir td) |
Is a one-way signal blocking the trackdir? A one-way signal on the trackdir against will block, but signals on both trackdirs won't. | |
RailType | GetTileRailType (TileIndex tile) |
Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile. | |
static void | SetRailGroundType (TileIndex t, RailGroundType rgt) |
static RailGroundType | GetRailGroundType (TileIndex t) |
static bool | IsSnowRailGround (TileIndex t) |
static void | MakeRailNormal (TileIndex t, Owner o, TrackBits b, RailType r) |
static void | MakeRailDepot (TileIndex t, Owner o, DepotID did, DiagDirection d, RailType r) |
Hides the direct accesses to the map array with map accessors.
Definition in file rail_map.h.
enum RailGroundType |
The ground 'under' the rail.
Definition at line 486 of file rail_map.h.
enum RailTileType |
Different types of Rail-related tiles.
RAIL_TILE_NORMAL |
Normal rail tile without signals. |
RAIL_TILE_SIGNALS |
Normal rail tile with signals. |
RAIL_TILE_DEPOT |
Depot (one entrance) |
Definition at line 24 of file rail_map.h.
Get the reserved track bits for a depot.
t | the tile |
Definition at line 283 of file rail_map.h.
References GetRailDepotTrack(), HasDepotReservation(), TRACK_BIT_NONE, and TrackToTrackBits().
Referenced by FollowTrainReservation(), and GetReservedTrackbits().
|
inlinestatic |
Get whether the given signals are present (Along/AgainstTrackDir)
tile | the tile to get the present signals for |
Definition at line 394 of file rail_map.h.
Referenced by AfterLoadCompanyStats(), CmdBuildSingleSignal(), CmdRemoveSingleSignal(), CmdSignalTrackHelper(), HasSignalOnTrack(), HasSignalOnTrackdir(), and IsSignalPresent().
|
inlinestatic |
Returns the direction the depot is facing to.
t | the tile to get the depot facing from |
Definition at line 172 of file rail_map.h.
Referenced by CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CmdBuildRailVehicle(), CmdBuildRailWagon(), DrawRailCatenary(), ExploreSegment(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::ForcedReverse(), FreeTrainTrackReservation(), GetDepotDirection(), GetRailDepotTrack(), Train::GetVehicleTrackdir(), ReverseTrainDirection(), TicksToLeaveDepot(), TrainCanLeaveTile(), TryPathReserve(), UpdateSignalsInBuffer(), and VehicleEnter_Track().
Returns the track of a depot, ignoring direction.
t | the tile to get the depot track from |
Definition at line 183 of file rail_map.h.
References DiagDirToDiagTrack(), and GetRailDepotDirection().
Referenced by AdvanceWagonsAfterSwap(), CmdConvertRail(), FixupTrainLengths(), and GetDepotReservationTrackBits().
Returns the reserved track bits of the tile.
t | the tile to query |
Definition at line 195 of file rail_map.h.
References _m, GB(), HasBit(), IsPlainRailTile(), TRACK_BIT_NONE, TrackToOppositeTrack(), and TrackToTrackBits().
Referenced by CheckFlatLandRailStation(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildSingleSignal(), CmdRemoveSingleRail(), DrawTrackBits(), GetReservedTrackbits(), TryReserveTrack(), and UnreserveTrack().
|
inlinestatic |
Returns the RailTileType (normal with or without signals, waypoint or depot).
t | the tile to get the information from |
Definition at line 37 of file rail_map.h.
References _m, GB(), IsTileType(), and MP_RAILWAY.
Referenced by CmdBuildRoad(), CmdConvertRail(), GetAxisForNewWaypoint(), GetRailTrackBitsUniversal(), HasSignalOnTrack(), HasSignalOnTrackdir(), HasSignals(), IsPlainRail(), IsPossibleCrossing(), IsRailDepot(), MoveWaypointsToBaseStations(), and PlaceExtraDepotRail().
Gets the rail type of the given tile.
t | the tile to get the rail type from |
Definition at line 116 of file rail_map.h.
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), CheckFlatLandRailStation(), CmdBuildBridge(), CmdBuildRailStation(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildSingleRail(), CmdConvertRail(), CmdRemoveSingleRail(), DoClearBridge(), DoClearTunnel(), DrawBridgeMiddle(), DrawRailCatenaryRailway(), DrawTile_Road(), DrawTile_TunnelBridge(), DrawTrackBits(), Train::GetMaxTrackSpeed(), Train::GetPower(), Train::GetPoweredPartPower(), GetPylonBase(), GetRailTrackBitsUniversal(), GetSmallMapRoutesPixels(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::GetSpeedLimit(), GetTileRailType(), StationScopeResolver::GetVariable(), GetWireBase(), IsCompatibleTrainStationTile(), MoveWaypointsToBaseStations(), RemoveFromRailBaseStation(), RemoveRoad(), and SetDefaultRailGui().
|
inlinestatic |
Gets the state of the signal along the given trackdir.
Along meaning if you are currently driving on the given trackdir, this is the signal that is facing us (for which we stop when it's red).
Definition at line 439 of file rail_map.h.
References GetSignalStates(), HasSignalOnTrack(), IsValidTrackdir(), SIGNAL_STATE_GREEN, SIGNAL_STATE_RED, SignalAlongTrackdir(), and TrackdirToTrack().
Referenced by CheckNextTrainTile(), ExploreSegment(), FreeTrainTrackReservation(), CYapfCostRailT< Types >::PfCalcCost(), and UpdateSignalsAroundSegment().
|
inlinestatic |
Set the states of the signals (Along/AgainstTrackDir)
tile | the tile to set the states for |
Definition at line 363 of file rail_map.h.
Referenced by CmdBuildSingleSignal(), GetSignalStateByTrackdir(), GetSingleSignalState(), and SetSignalStateByTrackdir().
|
inlinestatic |
Get the state of a single signal.
t | the tile to get the signal state for |
signalbit | the signal |
Definition at line 374 of file rail_map.h.
References GetSignalStates(), and HasBit().
Gets the track bits of the given tile.
tile | the tile to get the track bits from |
Definition at line 137 of file rail_map.h.
References _m, GB(), and IsPlainRailTile().
Referenced by AfterLoadCompanyStats(), ChangeOwnershipOfCompanyItems(), CheckFlatLandRailStation(), CheckTrackCombination(), CmdBuildRoad(), CmdBuildSingleRail(), CmdBuildSingleSignal(), CmdConvertRail(), CmdRemoveSingleRail(), DoDryUp(), ExploreSegment(), FloodHalftile(), GetAxisForNewWaypoint(), GetRailTrackBitsUniversal(), HasTrack(), IsPossibleCrossing(), PlaceExtraDepotRail(), and CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::QueryNewTileTrackStatus().
|
inlinestatic |
Get the reservation state of the depot.
t | the depot tile |
Definition at line 259 of file rail_map.h.
References _m, HasBit(), and IsRailDepot().
Referenced by CheckTrainStayInDepot(), GetDepotReservationTrackBits(), TryPathReserve(), and TryReserveRailTrack().
Is a one-way signal blocking the trackdir? A one-way signal on the trackdir against will block, but signals on both trackdirs won't.
tile | the tile to check |
td | the trackdir to check |
Definition at line 476 of file rail_map.h.
References HasSignalOnTrackdir(), IsOnewaySignal(), IsTileType(), MP_RAILWAY, ReverseTrackdir(), and TrackdirToTrack().
Referenced by ExtendTrainReservation(), FollowReservation(), GetTrainForReservation(), CYapfCostRailT< Types >::PfCalcCost(), and TrainController().
Is a pbs signal present along the trackdir?
tile | the tile to check |
td | the trackdir to check |
Definition at line 464 of file rail_map.h.
References HasSignalOnTrackdir(), IsTileType(), MP_RAILWAY, and TrackdirToTrack().
Referenced by CheckNextTrainTile(), FreeTrainTrackReservation(), GetTrainForReservation(), IsSafeWaitingPosition(), and TrainController().
Checks for the presence of signals along the given trackdir on the given rail tile.
Along meaning if you are currently driving on the given trackdir, this is the signal that is facing us (for which we stop when it's red).
Definition at line 427 of file rail_map.h.
References GetPresentSignals(), GetRailTileType(), IsValidTrackdir(), RAIL_TILE_SIGNALS, and SignalAlongTrackdir().
Referenced by CheckNextTrainTile(), CmdRemoveSingleSignal(), ExploreSegment(), FollowReservation(), FreeTrainTrackReservation(), HasOnewaySignalBlockingTrackdir(), HasPbsSignalOnTrackdir(), IsSafeWaitingPosition(), IsWaitingPositionFree(), CYapfCostRailT< Types >::PfCalcCost(), ReverseTrainDirection(), TrainController(), and UpdateSignalsAroundSegment().
|
inlinestatic |
Checks if a rail tile has signals.
t | the tile to get the information from |
Definition at line 73 of file rail_map.h.
References GetRailTileType(), and RAIL_TILE_SIGNALS.
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), ChangeOwnershipOfCompanyItems(), CheckFlatLandRailStation(), CheckTrackCombination(), CmdBuildSingleSignal(), ExploreSegment(), and TrainController().
Returns whether the given track is present on the given tile.
tile | the tile to check the track presence of |
track | the track to search for on the tile |
Definition at line 161 of file rail_map.h.
References GetTrackBits(), and HasBit().
Referenced by CmdBuildSingleSignal(), CmdRemoveSingleSignal(), CmdSignalTrackHelper(), TryReserveTrack(), and UnreserveTrack().
One-way signals can't be passed the 'wrong' way.
Definition at line 320 of file rail_map.h.
References SIGTYPE_PBS.
Referenced by ExploreSegment(), FreeTrainTrackReservation(), and HasOnewaySignalBlockingTrackdir().
|
inlinestatic |
Returns whether this is plain rails, with or without signals.
Iow, if this tiles RailTileType is RAIL_TILE_NORMAL or RAIL_TILE_SIGNALS.
t | the tile to get the information from |
Definition at line 50 of file rail_map.h.
References GetRailTileType(), RAIL_TILE_NORMAL, and RAIL_TILE_SIGNALS.
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), CheckTrackCombination(), CmdBuildBridge(), CmdBuildSingleRail(), CmdRemoveSingleRail(), DoDryUp(), DoFloodTile(), ExtendTrainReservation(), GetReservedTrackbits(), IsPlainRailTile(), IsWateredTile(), TryReserveRailTrack(), and UnreserveRailTrack().
|
inlinestatic |
Checks whether the tile is a rail tile or rail tile with signals.
t | the tile to get the information from |
Definition at line 61 of file rail_map.h.
References IsPlainRail(), IsTileType(), and MP_RAILWAY.
Referenced by AfterLoadGame(), CheckFlatLandRailStation(), CmdBuildSingleSignal(), CmdConvertRail(), CmdRemoveSingleSignal(), CmdSignalTrackHelper(), DisasterTick_Big_Ufo(), FixOwnerOfRailTrack(), FloodHalftile(), GetRailReservationTrackBits(), GetTrackBits(), MaskWireBits(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::QueryNewTileTrackStatus(), SetHasSignals(), SetTrackBits(), SetTrackReservation(), and TrainController().
|
inlinestatic |
Is this rail tile a rail depot?
t | the tile to get the information from |
Definition at line 96 of file rail_map.h.
References GetRailTileType(), and RAIL_TILE_DEPOT.
Referenced by AfterLoadGame(), DrawRailCatenary(), ExploreSegment(), GetReservedTrackbits(), HasDepotReservation(), IsRailDepotTile(), NPFMarkTile(), CYapfCostRailT< Types >::PfCalcCost(), SetDepotReservation(), TryReserveRailTrack(), UnreserveRailTrack(), and UpdateSignalsInBuffer().
|
inlinestatic |
Is this tile rail tile and a rail depot?
t | the tile to get the information from |
Definition at line 106 of file rail_map.h.
References IsRailDepot(), IsTileType(), and MP_RAILWAY.
Referenced by AfterLoadGame(), CmdInsertOrder(), DeleteLastWagon(), FindClosestTrainDepot(), FollowReservation(), FollowTrainReservation(), FreeTrainTrackReservation(), GetDepotIndex(), RailTypeScopeResolver::GetVariable(), IsDepotTile(), IsDepotTypeTile(), IsSafeWaitingPosition(), IsWaitingPositionFree(), CYapfDestinationAnyDepotRailT< Types >::PfDetectDestination(), ReverseTrainDirection(), TrainCanLeaveTile(), and VehicleEnter_Track().
|
inlinestatic |
Checks whether the given signals is present.
t | the tile to check on |
signalbit | the signal |
Definition at line 405 of file rail_map.h.
References GetPresentSignals(), and HasBit().
|
inlinestatic |
Set the reservation state of the depot.
t | the depot tile |
b | the reservation state |
Definition at line 271 of file rail_map.h.
References _m, IsRailDepot(), and SB().
Referenced by AfterLoadGame(), CheckTrainStayInDepot(), TryPathReserve(), TryReserveRailTrack(), UnreserveRailTrack(), and VehicleEnterDepot().
|
inlinestatic |
Add/remove the 'has signal' bit from the RailTileType.
tile | the tile to add/remove the signals to/from |
signals | whether the rail tile should have signals or not |
Definition at line 84 of file rail_map.h.
References _m, IsPlainRailTile(), and SB().
Referenced by CmdBuildSingleSignal(), and CmdRemoveSingleSignal().
|
inlinestatic |
Set whether the given signals are present (Along/AgainstTrackDir)
tile | the tile to set the present signals for |
signals | the signals that have to be present |
Definition at line 384 of file rail_map.h.
Referenced by CmdBuildSingleSignal(), and CmdRemoveSingleSignal().
Sets the rail type of the given tile.
t | the tile to set the rail type of |
r | the new rail type for the tile |
Definition at line 126 of file rail_map.h.
Referenced by AfterLoadGame(), CmdConvertRail(), MakeRailStation(), and MakeRailWaypoint().
|
inlinestatic |
Set the states of the signals (Along/AgainstTrackDir)
tile | the tile to set the states for |
state | the new state |
Definition at line 353 of file rail_map.h.
Referenced by AfterLoadGame(), CmdBuildSingleSignal(), CmdRemoveSingleSignal(), and SetSignalStateByTrackdir().
Sets the track bits of the given tile.
t | the tile to set the track bits of |
b | the new track bits for the tile |
Definition at line 148 of file rail_map.h.
References _m, IsPlainRailTile(), and SB().
Referenced by CmdBuildSingleRail(), and CmdRemoveSingleRail().
Sets the reserved track bits of the tile.
t | the tile to change |
b | the track bits |
Definition at line 210 of file rail_map.h.
References _m, INVALID_TRACK, INVALID_TRACK_BIT, IsPlainRailTile(), RemoveFirstTrack(), SB(), TRACK_BIT_NONE, and TracksOverlap().
Referenced by AfterLoadGame(), CmdRemoveSingleRail(), RemoveRoad(), TryReserveTrack(), and UnreserveTrack().
Try to reserve a specific track on a tile.
tile | the tile |
t | the rack to reserve |
Definition at line 227 of file rail_map.h.
References GetRailReservationTrackBits(), HasTrack(), SetTrackReservation(), TRACK_BIT_NONE, TracksOverlap(), and TrackToTrackBits().
Referenced by TryReserveRailTrack().
Lift the reservation of a specific track on a tile.
tile | the tile |
t | the track to free |
Definition at line 245 of file rail_map.h.
References GetRailReservationTrackBits(), HasTrack(), SetTrackReservation(), and TrackToTrackBits().
Referenced by UnreserveRailTrack().