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