#include "rail_type.h"
#include "signal_func.h"
#include "direction_func.h"
#include "track_func.h"
#include "tile_map.h"
Go to the source code of this file.
Enumerations | |
enum | RailTileType { RAIL_TILE_NORMAL = 0, RAIL_TILE_SIGNALS = 1, RAIL_TILE_WAYPOINT = 2, RAIL_TILE_DEPOT = 3 } |
Different types of Rail-related tiles. More... | |
enum | SignalType { SIGTYPE_NORMAL = 0, SIGTYPE_ENTRY = 1, SIGTYPE_EXIT = 2, SIGTYPE_COMBO = 3 } |
Type of signal, i.e. More... | |
enum | SignalVariant { SIG_ELECTRIC = 0, SIG_SEMAPHORE = 1 } |
Variant of the signal, i.e. More... | |
enum | SignalState { SIGNAL_STATE_RED = 0, SIGNAL_STATE_GREEN = 1 } |
These are states in which a signal can be. 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 | IsPlainRailTile (TileIndex t) |
Returns whether this is plain rails, with or without 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 tile a rail depot? | |
static bool | IsRailWaypoint (TileIndex t) |
Is this tile a rail waypoint? | |
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 Axis | GetWaypointAxis (TileIndex t) |
Returns the axis of the waypoint. | |
static Track | GetRailWaypointTrack (TileIndex t) |
Returns the track of the waypoint. | |
static TrackBits | GetRailWaypointBits (TileIndex t) |
Returns the track bits of the waypoint. | |
static WaypointID | GetWaypointIndex (TileIndex t) |
Returns waypoint index (for the waypoint pool). | |
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 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. | |
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, DiagDirection d, RailType r) |
static void | MakeRailWaypoint (TileIndex t, Owner o, Axis a, RailType r, uint index) |
Definition in file rail_map.h.
enum RailGroundType |
The ground 'under' the rail.
Definition at line 397 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_WAYPOINT | Waypoint (X or Y direction). |
RAIL_TILE_DEPOT | Depot (one entrance). |
Definition at line 16 of file rail_map.h.
enum SignalState |
These are states in which a signal can be.
Currently these are only two, so simple boolean logic will do. But do try to compare to this enum instead of normal boolean evaluation, since that will make future additions easier.
Definition at line 270 of file rail_map.h.
enum SignalType |
Type of signal, i.e.
how does the signal behave?
SIGTYPE_NORMAL | normal signal |
SIGTYPE_ENTRY | presignal block entry |
SIGTYPE_EXIT | presignal block exit |
SIGTYPE_COMBO | presignal inter-block |
Definition at line 205 of file rail_map.h.
enum SignalVariant |
static uint GetPresentSignals | ( | TileIndex | tile | ) | [inline, static] |
Get whether the given signals are present (Along/AgainstTrackDir).
tile | the tile to get the present signals for |
Definition at line 321 of file rail_map.h.
Referenced by CmdBuildSingleSignal(), CmdRemoveSingleSignal(), CmdSignalTrackHelper(), HasSignalOnTrack(), HasSignalOnTrackdir(), and IsSignalPresent().
static DiagDirection GetRailDepotDirection | ( | TileIndex | t | ) | [inline, static] |
Returns the direction the depot is facing to.
t | the tile to get the depot facing from |
Definition at line 154 of file rail_map.h.
Referenced by AdvanceWagonsAfterSwap(), CanAccessTileInDir(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_ >::CanEnterNewTile(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdConvertRail(), DrawCatenary(), ExploreSegment(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_ >::ForcedReverse(), GetDepotDirection(), GetVehicleTrackdir(), TicksToLeaveDepot(), TrainCanLeaveTile(), and UpdateSignalsInBuffer().
static RailTileType GetRailTileType | ( | TileIndex | t | ) | [inline, static] |
Returns the RailTileType (normal with or without signals, waypoint or depot).
t | the tile to get the information from |
Definition at line 30 of file rail_map.h.
References _m, GB(), IsTileType(), and MP_RAILWAY.
Referenced by CmdBuildRoad(), CmdBuildTrainWaypoint(), CmdConvertRail(), ExploreSegment(), GetRailTrackBitsUniversal(), HasSignalOnTrack(), HasSignalOnTrackdir(), HasSignals(), IsDepotTile(), IsPlainRailTile(), IsRailDepot(), IsRailWaypoint(), and IsTileDepotType().
Gets the rail type of the given tile.
t | the tile to get the rail type from |
Definition at line 100 of file rail_map.h.
Referenced by CmdBuildBridge(), CmdBuildRailVehicle(), CmdBuildRoad(), CmdBuildSingleRail(), CmdBuildTrainWaypoint(), CmdConvertRail(), DrawCatenary(), DrawCatenaryOnTunnel(), DrawCatenaryRailway(), DrawTile_TunnelBridge(), DrawTrackBits(), GetRailTrackBitsUniversal(), GetTileRailType(), RemoveRoad(), RemoveTrainWaypoint(), and TrainPowerChanged().
Returns the track bits of the waypoint.
t | the tile to get the waypoint track bits from |
Definition at line 188 of file rail_map.h.
References GetRailWaypointTrack(), and TrackToTrackBits().
Referenced by GetRailTrackBitsUniversal(), and RemoveTrainWaypoint().
Returns the track of the waypoint.
t | the tile to get the waypoint track from |
Definition at line 177 of file rail_map.h.
References AxisToTrack(), and GetWaypointAxis().
Referenced by GetRailWaypointBits(), and RemoveTrainWaypoint().
static SignalState GetSignalStateByTrackdir | ( | TileIndex | tile, | |
Trackdir | trackdir | |||
) | [inline, static] |
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 370 of file rail_map.h.
References GetSignalStates(), HasSignalOnTrack(), IsValidTrackdir(), SIGNAL_STATE_GREEN, SIGNAL_STATE_RED, SignalAlongTrackdir(), and TrackdirToTrack().
Referenced by ExploreSegment(), and UpdateSignalsAroundSegment().
static uint GetSignalStates | ( | TileIndex | tile | ) | [inline, static] |
Set the states of the signals (Along/AgainstTrackDir).
tile | the tile to set the states for | |
state | the new state |
Definition at line 290 of file rail_map.h.
Referenced by GetSignalStateByTrackdir(), GetSingleSignalState(), and SetSignalStateByTrackdir().
static SignalState GetSingleSignalState | ( | TileIndex | t, | |
byte | signalbit | |||
) | [inline, static] |
Get the state of a single signal.
t | the tile to get the signal state for | |
signalbit | the signal |
Definition at line 301 of file rail_map.h.
References GetSignalStates(), and HasBit().
Gets the track bits of the given tile.
t | the tile to get the track bits from |
Definition at line 121 of file rail_map.h.
Referenced by CmdBuildRoad(), CmdBuildSingleRail(), CmdBuildSingleSignal(), CmdBuildTrainWaypoint(), CmdConvertRail(), CmdRemoveSingleRail(), DoDryUp(), ExploreSegment(), FloodHalftile(), GetRailTrackBitsUniversal(), HasTrack(), IsPossibleCrossing(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_ >::QueryNewTileTrackStatus(), and RemoveRoad().
Returns the axis of the waypoint.
t | the tile to get the waypoint axis from |
Definition at line 166 of file rail_map.h.
Referenced by CmdConvertRail(), ExploreSegment(), and GetRailWaypointTrack().
static WaypointID GetWaypointIndex | ( | TileIndex | t | ) | [inline, static] |
Returns waypoint index (for the waypoint pool).
t | the tile to get the waypoint index from |
Definition at line 199 of file rail_map.h.
Referenced by GetWaypointByTile().
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 356 of file rail_map.h.
References GetPresentSignals(), GetRailTileType(), IsValidTrackdir(), RAIL_TILE_SIGNALS, and SignalAlongTrackdir().
Referenced by ExploreSegment(), and UpdateSignalsAroundSegment().
static bool HasSignals | ( | TileIndex | t | ) | [inline, static] |
Checks if a rail tile has signals.
t | the tile to get the information from |
Definition at line 55 of file rail_map.h.
References GetRailTileType(), and RAIL_TILE_SIGNALS.
Referenced by CmdBuildSingleSignal(), CmdSignalTrackHelper(), ExploreSegment(), and IsPossibleCrossing().
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 143 of file rail_map.h.
References GetTrackBits(), and HasBit().
Referenced by CmdBuildSingleSignal(), CmdRemoveSingleSignal(), and CmdSignalTrackHelper().
static bool IsPlainRailTile | ( | TileIndex | t | ) | [inline, static] |
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 43 of file rail_map.h.
References GetRailTileType(), RAIL_TILE_NORMAL, and RAIL_TILE_SIGNALS.
Referenced by CmdBuildBridge(), CmdBuildSingleSignal(), CmdRemoveSingleRail(), DisasterTick_Big_Ufo(), DoDryUp(), DoFloodTile(), IsWateredTile(), CFollowTrackT< Ttr_type_, T90deg_turns_allowed_ >::QueryNewTileTrackStatus(), and SetHasSignals().
static bool IsRailDepot | ( | TileIndex | t | ) | [inline, static] |
Is this tile a rail depot?
t | the tile to get the information from |
Definition at line 78 of file rail_map.h.
References GetRailTileType(), and RAIL_TILE_DEPOT.
Referenced by DrawCatenary(), ExploreSegment(), and UpdateSignalsInBuffer().
static bool IsRailWaypoint | ( | TileIndex | t | ) | [inline, static] |
Is this tile a rail waypoint?
t | the tile to get the information from |
Definition at line 89 of file rail_map.h.
References GetRailTileType(), and RAIL_TILE_WAYPOINT.
Referenced by GetWaypointByTile(), and RemoveTrainWaypoint().
static bool IsSignalPresent | ( | TileIndex | t, | |
byte | signalbit | |||
) | [inline, static] |
Checks whether the given signals is present.
t | the tile to check on | |
signalbit | the signal |
Definition at line 332 of file rail_map.h.
References GetPresentSignals(), and HasBit().
static void SetHasSignals | ( | TileIndex | tile, | |
bool | signals | |||
) | [inline, static] |
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 66 of file rail_map.h.
References _m, IsPlainRailTile(), and SB().
Referenced by CmdBuildSingleSignal(), and CmdRemoveSingleSignal().
static void SetPresentSignals | ( | TileIndex | tile, | |
uint | signals | |||
) | [inline, static] |
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 311 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 110 of file rail_map.h.
Referenced by CmdConvertRail().
static void SetSignalStates | ( | TileIndex | tile, | |
uint | state | |||
) | [inline, static] |
Set the states of the signals (Along/AgainstTrackDir).
tile | the tile to set the states for | |
state | the new state |
Definition at line 280 of file rail_map.h.
Referenced by 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 131 of file rail_map.h.
Referenced by CmdBuildSingleRail(), and CmdRemoveSingleRail().