|
OpenTTD Source 20251117-master-g7398d2e290
|
Functions related to signals. More...
#include "track_type.h"#include "tile_type.h"#include "direction_type.h"#include "company_type.h"Go to the source code of this file.
Enumerations | |
| enum | SigSegState : uint8_t { SIGSEG_FREE , SIGSEG_FULL , SIGSEG_PBS } |
| State of the signal segment. More... | |
Functions | |
| uint8_t | SignalAlongTrackdir (Trackdir trackdir) |
| Maps a trackdir to the bit that stores its status in the map arrays, in the direction along with the trackdir. | |
| uint8_t | SignalAgainstTrackdir (Trackdir trackdir) |
| Maps a trackdir to the bit that stores its status in the map arrays, in the direction against the trackdir. | |
| uint8_t | SignalOnTrack (Track track) |
| Maps a Track to the bits that store the status of the two signals that can be present on the given track. | |
| SigSegState | UpdateSignalsOnSegment (TileIndex tile, DiagDirection side, Owner owner) |
| Update signals, starting at one side of a tile Will check tile next to this at opposite side too. | |
| void | SetSignalsOnBothDir (TileIndex tile, Track track, Owner owner) |
| Update signals at segments that are at both ends of given (existent or non-existent) track. | |
| void | AddTrackToSignalBuffer (TileIndex tile, Track track, Owner owner) |
| Add track to signal update buffer. | |
| void | AddSideToSignalBuffer (TileIndex tile, DiagDirection side, Owner owner) |
| Add side of tile to signal update buffer. | |
| void | UpdateSignalsInBuffer () |
| Update signals in buffer Called from 'outside'. | |
Functions related to signals.
Definition in file signal_func.h.
| enum SigSegState : uint8_t |
State of the signal segment.
| Enumerator | |
|---|---|
| SIGSEG_FREE | Free and has no pre-signal exits or at least one green exit. |
| SIGSEG_FULL | Occupied by a train. |
| SIGSEG_PBS | Segment is a PBS segment. |
Definition at line 49 of file signal_func.h.
| void AddSideToSignalBuffer | ( | TileIndex | tile, |
| DiagDirection | side, | ||
| Owner | owner | ||
| ) |
Add side of tile to signal update buffer.
| tile | tile where we start |
| side | side of tile |
| owner | owner whose signals we will update |
Definition at line 621 of file signal.cpp.
References _globset, _last_owner, INVALID_OWNER, SIG_GLOB_UPDATE, and UpdateSignalsInBuffer().
Referenced by CmdBuildBridge(), CmdBuildTrainDepot(), CmdBuildTunnel(), DoClearBridge(), DoClearTunnel(), and FreeTrainTrackReservation().
Add track to signal update buffer.
| tile | tile where we start |
| track | track at which ends we will update signals |
| owner | owner whose signals we will update |
Definition at line 589 of file signal.cpp.
References _globset, _last_owner, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, INVALID_OWNER, SIG_GLOB_UPDATE, and UpdateSignalsInBuffer().
Referenced by ChangeOwnershipOfCompanyItems(), CmdBuildRailStation(), CmdBuildSingleRail(), CmdBuildSingleSignal(), CmdRemoveSingleRail(), CmdRemoveSingleSignal(), RemoveFromRailBaseStation(), and SetSignalsOnBothDir().
Update signals at segments that are at both ends of given (existent or non-existent) track.
| tile | tile where we start |
| track | track at which ends we will update signals |
| owner | owner whose signals we will update |
Definition at line 665 of file signal.cpp.
References _globset, AddTrackToSignalBuffer(), and UpdateSignalsInBuffer().
Referenced by DeleteLastWagon().
|
inline |
Maps a trackdir to the bit that stores its status in the map arrays, in the direction against the trackdir.
Definition at line 32 of file signal_func.h.
References TRACKDIR_END.
Referenced by CmdSignalTrackHelper().
|
inline |
Maps a trackdir to the bit that stores its status in the map arrays, in the direction along with the trackdir.
Definition at line 22 of file signal_func.h.
References TRACKDIR_END.
Referenced by CmdSignalTrackHelper(), GetSignalStateByTrackdir(), HasSignalOnTrackdir(), and SetSignalStateByTrackdir().
|
inline |
Maps a Track to the bits that store the status of the two signals that can be present on the given track.
Definition at line 42 of file signal_func.h.
References TRACK_END.
Referenced by CmdBuildSingleSignal(), CmdRemoveSingleSignal(), CmdSignalTrackHelper(), and HasSignalOnTrack().
| void UpdateSignalsInBuffer | ( | ) |
Update signals in buffer Called from 'outside'.
Definition at line 573 of file signal.cpp.
References _globset, _last_owner, INVALID_OWNER, and UpdateSignalsInBuffer().
Referenced by AddSideToSignalBuffer(), AddTrackToSignalBuffer(), ChangeOwnershipOfCompanyItems(), DoFloodTile(), FreeTrainTrackReservation(), CommandHelperBase::InternalExecuteProcessResult(), SetSignalsOnBothDir(), UpdateSignalsInBuffer(), and UpdateSignalsOnSegment().
| SigSegState UpdateSignalsOnSegment | ( | TileIndex | tile, |
| DiagDirection | side, | ||
| Owner | owner | ||
| ) |
Update signals, starting at one side of a tile Will check tile next to this at opposite side too.
| tile | tile where we start |
| side | side of tile |
| owner | owner whose signals we will update |
Definition at line 647 of file signal.cpp.
References _globset, and UpdateSignalsInBuffer().
Referenced by CheckTrainStayInDepot(), DeleteLastWagon(), ReverseTrainDirection(), TrainController(), and VehicleEnterDepot().