OpenTTD
Enumerations | Functions
signal_func.h File Reference

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 { SIGSEG_FREE, SIGSEG_FULL, SIGSEG_PBS }
 State of the signal segment. More...
 

Functions

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 trackdir.
 
static byte SignalAgainstTrackdir (Trackdir trackdir)
 Maps a trackdir to the bit that stores its status in the map arrays, in the direction against the trackdir.
 
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 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. More...
 
void SetSignalsOnBothDir (TileIndex tile, Track track, Owner owner)
 Update signals at segments that are at both ends of given (existent or non-existent) track. More...
 
void AddTrackToSignalBuffer (TileIndex tile, Track track, Owner owner)
 Add track to signal update buffer. More...
 
void AddSideToSignalBuffer (TileIndex tile, DiagDirection side, Owner owner)
 Add side of tile to signal update buffer. More...
 
void UpdateSignalsInBuffer ()
 Update signals in buffer Called from 'outside'.
 

Detailed Description

Functions related to signals.

Definition in file signal_func.h.

Enumeration Type Documentation

◆ SigSegState

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 51 of file signal_func.h.

Function Documentation

◆ AddSideToSignalBuffer()

void AddSideToSignalBuffer ( TileIndex  tile,
DiagDirection  side,
Owner  owner 
)

Add side of tile to signal update buffer.

Parameters
tiletile where we start
sideside of tile
ownerowner whose signals we will update

Definition at line 614 of file signal.cpp.

◆ AddTrackToSignalBuffer()

void AddTrackToSignalBuffer ( TileIndex  tile,
Track  track,
Owner  owner 
)

Add track to signal update buffer.

Parameters
tiletile where we start
tracktrack at which ends we will update signals
ownerowner whose signals we will update

Definition at line 582 of file signal.cpp.

References DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, and DIAGDIR_SW.

◆ SetSignalsOnBothDir()

void SetSignalsOnBothDir ( TileIndex  tile,
Track  track,
Owner  owner 
)

Update signals at segments that are at both ends of given (existent or non-existent) track.

See also
UpdateSignalsInBuffer()
Parameters
tiletile where we start
tracktrack at which ends we will update signals
ownerowner whose signals we will update

Definition at line 658 of file signal.cpp.

◆ 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.

See also
UpdateSignalsInBuffer()
Parameters
tiletile where we start
sideside of tile
ownerowner whose signals we will update
Returns
the state of the signal segment

Definition at line 640 of file signal.cpp.

Referenced by CheckTrainStayInDepot().