87 SB(
_m[tile].m5, 6, 1, signals);
128 SB(
_m[t].m3, 0, 4, r);
151 SB(
_m[t].m5, 0, 6, b);
198 byte track_b =
GB(
_m[t].m2, 8, 3);
274 SB(
_m[t].m5, 4, 1, (byte)b);
305 SB(
_m[t].m2, pos, 3, s);
330 sig =
GB(
_m[t].m3, pos, 2);
331 if (--sig == 0) sig = IsPbsSignal(GetSignalType(t, track)) ? 2 : 3;
332 SB(
_m[t].m3, pos, 2, sig);
344 SB(
_m[t].m2, pos, 1, v);
355 SB(
_m[tile].m4, 4, 4, state);
365 return GB(
_m[tile].m4, 4, 4);
386 SB(
_m[tile].m3, 4, 4, signals);
396 return GB(
_m[tile].m3, 4, 4);
506 SB(
_m[t].m4, 0, 4, rgt);
514 static inline bool IsSnowRailGround(
TileIndex t)
528 SB(
_me[t].m6, 2, 4, 0);
541 SB(
_me[t].m6, 2, 4, 0);
Grass with a fence at the northern side.
static bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
Checks for the presence of signals along the given trackdir on the given rail tile.
uint16 DepotID
Type for the unique identifier of depots.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
Grass with a fence at the NE and SW edges.
SignalType
Type of signal, i.e.
RailType
Enumeration for all possible railtypes.
static SignalState GetSingleSignalState(TileIndex t, byte signalbit)
Get the state of a single signal.
static void UnreserveTrack(TileIndex tile, Track t)
Lift the reservation of a specific track on a tile.
static Track TrackdirToTrack(Trackdir trackdir)
Returns the Track that a given Trackdir represents.
byte m7
Primarily used for newgrf support.
static bool HasSignalOnTrack(TileIndex tile, Track track)
Checks for the presence of signals (either way) on the given track on the given rail tile...
uint16 m2
Primarily used for indices to towns, industries and stations.
Track
These are used to specify a single track.
Tile * _m
Tiles of the map.
static bool TryReserveTrack(TileIndex tile, Track t)
Try to reserve a specific track on a tile.
SignalState
These are states in which a signal can be.
Grass with a fence at the eastern side.
static bool IsOnewaySignal(TileIndex t, Track track)
One-way signals can't be passed the 'wrong' way.
static Track TrackToOppositeTrack(Track t)
Find the opposite track to a given track.
Grass with a fence at the SW edge.
static Track DiagDirToDiagTrack(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track incidating with that diagdir.
static void SetHasSignals(TileIndex tile, bool signals)
Add/remove the 'has signal' bit from the RailTileType.
static void SetTrackBits(TileIndex t, TrackBits b)
Sets the track bits of the given tile.
static uint GetSignalStates(TileIndex tile)
Set the states of the signals (Along/AgainstTrackDir)
static void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state)
Sets the state of the signal along the given trackdir.
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.
Grass with a fence at the NW and SE edges.
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...
Normal rail tile with signals.
static uint GetPresentSignals(TileIndex tile)
Get whether the given signals are present (Along/AgainstTrackDir)
Snow only on higher part of slope (steep or one corner raised)
TrackBits
Bitfield corresponding to Track.
Header files for depots (not hangars)
Types and classes related to signals.
static bool IsValidTrackdir(Trackdir trackdir)
Checks if a Trackdir is valid for non-road vehicles.
Flag for an invalid trackbits value.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a give tiletype.
static bool IsSignalPresent(TileIndex t, byte signalbit)
Checks whether the given signals is present.
static bool IsValidTrack(Track track)
Checks if a Track is valid.
Grass with a fence at the NW edge.
static DiagDirection GetRailDepotDirection(TileIndex t)
Returns the direction the depot is facing to.
Track in the right corner of the tile (east)
RailType GetTileRailType(TileIndex tile)
Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
Track in the lower corner of the tile (south)
TileExtended * _me
Extended Tiles of the map.
Trackdir
Enumeration for tracks and directions.
static bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
Is a pbs signal present along the trackdir?
Grass with a fence at the NE edge.
static void SetSignalStates(TileIndex tile, uint state)
Set the states of the signals (Along/AgainstTrackDir)
static void SetPresentSignals(TileIndex tile, uint signals)
Set whether the given signals are present (Along/AgainstTrackDir)
Grass with a fence and shore or water on the free halftile.
static Track GetRailDepotTrack(TileIndex t)
Returns the track of a depot, ignoring direction.
DiagDirection
Enumeration for diagonal directions.
static bool IsPlainRailTile(TileIndex t)
Checks whether the tile is a rail tile or rail tile with signals.
static Trackdir ReverseTrackdir(Trackdir trackdir)
Maps a trackdir to the reverse trackdir.
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
static TrackBits TrackToTrackBits(Track track)
Maps a Track to the corresponding TrackBits value.
Flag for an invalid track.
static bool IsRailDepot(TileIndex t)
Is this rail tile a rail depot?
static Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
static bool IsRailDepotTile(TileIndex t)
Is this tile rail tile and a rail depot?
uint32 TileIndex
The index/ID of a Tile.
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 ...
static TrackBits GetDepotReservationTrackBits(TileIndex t)
Get the reserved track bits for a depot.
RailTileType
Different types of Rail-related tiles.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
static void SetTileType(TileIndex tile, TileType type)
Set the type of a tile.
static bool HasTrack(TileIndex tile, Track track)
Returns whether the given track is present on the given tile.
Normal rail tile without signals.
RailGroundType
The ground 'under' the rail.
Grass with a fence at the SE edge.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static bool IsPlainRail(TileIndex t)
Returns whether this is plain rails, with or without signals.
Map writing/reading functions for tiles.
static bool HasDepotReservation(TileIndex t)
Get the reservation state of the depot.
Owner
Enum for all companies/owners.
Different conversion functions from one kind of track to another.
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...
Functions related to signals.
Grass with a fence at the southern side.
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
static SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
Gets the state of the signal along the given trackdir.
SignalVariant
Variant of the signal, i.e.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
static bool TracksOverlap(TrackBits bits)
Checks if the given tracks overlap, ie form a crossing.
Grass with a fence at the western side.
static void SetRailType(TileIndex t, RailType r)
Sets the rail type of the given tile.
The different types of rail.
static void SetDepotReservation(TileIndex t, bool b)
Set the reservation state of the depot.