OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
86 SB(
_m[tile].m5, 6, 1, signals);
127 SB(
_me[t].m8, 0, 6, r);
150 SB(
_m[t].m5, 0, 6, b);
197 byte track_b =
GB(
_m[t].m2, 8, 3);
273 SB(
_m[t].m5, 4, 1, (
byte)b);
304 SB(
_m[t].m2, pos, 3, s);
329 sig =
GB(
_m[t].m3, pos, 2);
330 if (--sig == 0) sig = IsPbsSignal(GetSignalType(t, track)) ? 2 : 3;
331 SB(
_m[t].m3, pos, 2, sig);
343 SB(
_m[t].m2, pos, 1, v);
354 SB(
_m[tile].m4, 4, 4, state);
364 return GB(
_m[tile].m4, 4, 4);
385 SB(
_m[tile].m3, 4, 4, signals);
395 return GB(
_m[tile].m3, 4, 4);
505 SB(
_m[t].m4, 0, 4, rgt);
513 static inline bool IsSnowRailGround(
TileIndex t)
528 SB(
_me[t].m6, 2, 4, 0);
543 SB(
_me[t].m6, 2, 4, 0);
uint32 TileIndex
The index/ID of a Tile.
@ TRACK_BIT_NONE
No track.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
@ RAIL_GROUND_HALF_SNOW
Snow only on higher part of slope (steep or one corner raised)
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 void SetTileType(TileIndex tile, TileType type)
Set the type of a tile.
@ RAIL_GROUND_FENCE_SE
Grass with a fence at the SE edge.
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
@ TRACK_LOWER
Track in the lower corner of the tile (south)
@ RAIL_TILE_SIGNALS
Normal rail tile with signals.
uint16 DepotID
Type for the unique identifier of depots.
@ RAIL_GROUND_FENCE_NW
Grass with a fence at the NW edge.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
TileExtended * _me
Extended Tiles of the map.
@ SIGNAL_STATE_GREEN
The signal is green.
@ RAIL_GROUND_FENCE_VERT1
Grass with a fence at the eastern side.
static bool TracksOverlap(TrackBits bits)
Checks if the given tracks overlap, ie form a crossing.
uint16 m2
Primarily used for indices to towns, industries and stations.
@ RAIL_GROUND_BARREN
Nothing (dirt)
SignalState
These are states in which a signal can be.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
@ RAIL_GROUND_FENCE_SENW
Grass with a fence at the NW and SE edges.
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
@ RAIL_GROUND_FENCE_VERT2
Grass with a fence at the western side.
Owner
Enum for all companies/owners.
static bool IsRailDepot(TileIndex t)
Is this rail tile a rail depot?
@ TRACK_RIGHT
Track in the right corner of the tile (east)
static Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
static DiagDirection GetRailDepotDirection(TileIndex t)
Returns the direction the depot is facing to.
static bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
Is a pbs signal present along the trackdir?
static SignalState GetSingleSignalState(TileIndex t, byte signalbit)
Get the state of a single signal.
static TrackBits TrackToTrackBits(Track track)
Maps a Track to the corresponding TrackBits value.
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
SignalType
Type of signal, i.e.
static uint GetPresentSignals(TileIndex tile)
Get whether the given signals are present (Along/AgainstTrackDir)
@ SIGTYPE_PBS
normal pbs signal
@ RAIL_GROUND_GRASS
Grassy.
RailType
Enumeration for all possible railtypes.
static bool IsValidTrack(Track track)
Checks if a Track is valid.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
@ SIGNAL_STATE_RED
The signal is red.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
static Track TrackToOppositeTrack(Track t)
Find the opposite track to a given track.
@ SIGTYPE_EXIT
presignal block exit
static bool IsSignalPresent(TileIndex t, byte signalbit)
Checks whether the given signals is present.
static bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
Checks for the presence of signals along the given trackdir on the given rail tile.
@ SIGTYPE_COMBO
presignal inter-block
static void SetHasSignals(TileIndex tile, bool signals)
Add/remove the 'has signal' bit from the RailTileType.
static void SetSignalStates(TileIndex tile, uint state)
Set the states of the signals (Along/AgainstTrackDir)
static bool HasDepotReservation(TileIndex t)
Get the reservation state of the depot.
static Track DiagDirToDiagTrack(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track incidating with that diagdir.
static void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state)
Sets the state of the signal along the given trackdir.
static bool IsRailDepotTile(TileIndex t)
Is this tile rail tile and a rail depot?
static void SetDockingTile(TileIndex t, bool b)
Set the docking tile state of a tile.
static void SetTrackBits(TileIndex t, TrackBits b)
Sets the track bits of the given tile.
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,...
static TrackBits GetDepotReservationTrackBits(TileIndex t)
Get the reserved track bits for a depot.
DiagDirection
Enumeration for diagonal directions.
@ INVALID_TRACK_BIT
Flag for an invalid trackbits value.
static bool IsOnewaySignal(TileIndex t, Track track)
One-way signals can't be passed the 'wrong' way.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
static void SetDepotReservation(TileIndex t, bool b)
Set the reservation state of the depot.
RailGroundType
The ground 'under' the rail.
@ RAIL_GROUND_WATER
Grass with a fence and shore or water on the free halftile.
SignalVariant
Variant of the signal, i.e.
@ SIGTYPE_PBS_ONEWAY
no-entry signal
@ RAIL_GROUND_FENCE_HORIZ1
Grass with a fence at the southern side.
@ SIGTYPE_ENTRY
presignal block entry
static uint GetSignalStates(TileIndex tile)
Set the states of the signals (Along/AgainstTrackDir)
static bool IsPlainRail(TileIndex t)
Returns whether this is plain rails, with or without signals.
RailType GetTileRailType(TileIndex tile)
Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
static void UnreserveTrack(TileIndex tile, Track t)
Lift the reservation of a specific track on a tile.
static SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
Gets the state of the signal along the given trackdir.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
static void SetPresentSignals(TileIndex tile, uint signals)
Set whether the given signals are present (Along/AgainstTrackDir)
@ RAIL_TILE_NORMAL
Normal rail tile without signals.
@ RAIL_GROUND_FENCE_NE
Grass with a fence at the NE edge.
static Track GetRailDepotTrack(TileIndex t)
Returns the track of a depot, ignoring direction.
static byte SignalOnTrack(Track track)
Maps a Track to the bits that store the status of the two signals that can be present on the given tr...
TrackBits
Bitfield corresponding to Track.
static bool IsPlainRailTile(TileIndex t)
Checks whether the tile is a rail tile or rail tile with signals.
byte m7
Primarily used for newgrf support.
static Trackdir ReverseTrackdir(Trackdir trackdir)
Maps a trackdir to the reverse trackdir.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
@ RAIL_GROUND_FENCE_HORIZ2
Grass with a fence at the northern side.
Trackdir
Enumeration for tracks and directions.
@ RAIL_TILE_DEPOT
Depot (one entrance)
Track
These are used to specify a single track.
RailTileType
Different types of Rail-related tiles.
static bool HasTrack(TileIndex tile, Track track)
Returns whether the given track is present on the given tile.
uint16 m8
General purpose.
static bool TryReserveTrack(TileIndex tile, Track t)
Try to reserve a specific track on a tile.
static bool IsValidTrackdir(Trackdir trackdir)
Checks if a Trackdir is valid for non-road vehicles.
static void SetRailType(TileIndex t, RailType r)
Sets the rail type of the given tile.
@ RAIL_GROUND_ICE_DESERT
Icy or sandy.
Tile * _m
Tiles of the map.
static byte SignalAlongTrackdir(Trackdir trackdir)
Maps a trackdir to the bit that stores its status in the map arrays, in the direction along with the ...
@ RAIL_GROUND_FENCE_SW
Grass with a fence at the SW edge.
static Track TrackdirToTrack(Trackdir trackdir)
Returns the Track that a given Trackdir represents.
@ INVALID_TRACK
Flag for an invalid track.
@ RAIL_GROUND_FENCE_NESW
Grass with a fence at the NE and SW edges.