Data Structures | Functions

pbs.h File Reference

PBS support routines. More...

#include "tile_type.h"
#include "direction_type.h"
#include "track_type.h"
#include "vehicle_type.h"

Go to the source code of this file.

Data Structures

struct  PBSTileInfo
 This struct contains information about the end of a reserved path. More...

Functions

TrackBits GetReservedTrackbits (TileIndex t)
 Get the reserved trackbits for any tile, regardless of type.
void SetRailStationPlatformReservation (TileIndex start, DiagDirection dir, bool b)
 Set the reservation for a complete station platform.
bool TryReserveRailTrack (TileIndex tile, Track t)
 Try to reserve a specific track on a tile.
void UnreserveRailTrack (TileIndex tile, Track t)
 Lift the reservation of a specific track on a tile.
PBSTileInfo FollowTrainReservation (const Train *v, Vehicle **train_on_res=NULL)
 Follow a train reservation to the last tile.
bool IsSafeWaitingPosition (const Train *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg=false)
 Determine whether a certain track on a tile is a safe position to end a path.
bool IsWaitingPositionFree (const Train *v, TileIndex tile, Trackdir trackdir, bool forbid_90deg=false)
 Check if a safe position is free.
TrainGetTrainForReservation (TileIndex tile, Track track)
 Find the train which has reserved a specific path.
static bool HasReservedTracks (TileIndex tile, TrackBits tracks)
 Check whether some of tracks is reserved on a tile.

Detailed Description

PBS support routines.

Definition in file pbs.h.


Function Documentation

PBSTileInfo FollowTrainReservation ( const Train v,
Vehicle **  train_on_res 
)
TrackBits GetReservedTrackbits ( TileIndex  t  ) 
Train* GetTrainForReservation ( TileIndex  tile,
Track  track 
)
static bool HasReservedTracks ( TileIndex  tile,
TrackBits  tracks 
) [inline, static]

Check whether some of tracks is reserved on a tile.

Parameters:
tile the tile
tracks the tracks to test
Returns:
true if at least on of tracks is reserved

Definition at line 50 of file pbs.h.

References GetReservedTrackbits().

Referenced by CheckNextTrainTile(), CmdBuildSingleSignal(), CmdRemoveSingleRail(), CmdRemoveSingleSignal(), DeleteLastWagon(), DrawTrackBits(), ExtendTrainReservation(), FollowReservation(), GetTrainForReservation(), IsWaitingPositionFree(), and TryPathReserve().

bool IsSafeWaitingPosition ( const Train v,
TileIndex  tile,
Trackdir  trackdir,
bool  include_line_end,
bool  forbid_90deg 
)
bool IsWaitingPositionFree ( const Train v,
TileIndex  tile,
Trackdir  trackdir,
bool  forbid_90deg 
)
void SetRailStationPlatformReservation ( TileIndex  start,
DiagDirection  dir,
bool  b 
)

Set the reservation for a complete station platform.

Precondition:
IsRailStationTile(start)
Parameters:
start starting tile of the platform
dir the direction in which to follow the platform
b the state the reservation should be set to

Definition at line 56 of file pbs.cpp.

References DiagDirToAxis(), GetRailStationAxis(), IsCompatibleTrainStationTile(), IsRailStationTile(), MarkTileDirtyByTile(), SetRailStationReservation(), TILE_ADD, and TileOffsByDiagDir().

Referenced by ClearPathReservation(), CmdBuildRailStation(), NPFSaveTargetData(), and RemoveFromRailBaseStation().

bool TryReserveRailTrack ( TileIndex  tile,
Track  t 
)
void UnreserveRailTrack ( TileIndex  tile,
Track  t 
)