# pbs.h

Go to the documentation of this file.

    00001 /* $Id: pbs.h 14258 2008-09-07 11:23:10Z rubidium $ */
    00002
    00005 #ifndef PBS_H
    00006 #define PBS_H
    00007
    00008 #include "tile_type.h"
    00009 #include "direction_type.h"
    00010 #include "track_type.h"
    00011 #include "vehicle_type.h"
    00012
    00013 TrackBits GetReservedTrackbits(TileIndex t);
    00014
    00015 void SetRailwayStationPlatformReservation(TileIndex start, DiagDirection dir, bool b);
    00016
    00017 bool TryReserveRailTrack(TileIndex tile, Track t);
    00018 void UnreserveRailTrack(TileIndex tile, Track t);
    00019
    00021 struct PBSTileInfo {
    00022   TileIndex tile;
    00023   Trackdir  trackdir;
    00024   bool      okay;
    00025
    00026   PBSTileInfo() : tile(INVALID_TILE), trackdir(INVALID_TRACKDIR), okay(false) {}
    00027   PBSTileInfo(TileIndex _t, Trackdir _td, bool _okay) : tile(_t), trackdir(_td), okay(_okay) {}
    00028 };
    00029
    00030 PBSTileInfo FollowTrainReservation(const Vehicle *v, bool *train_on_res = NULL);
    00031 bool IsSafeWaitingPosition(const Vehicle *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg = false);
    00032 bool IsWaitingPositionFree(const Vehicle *v, TileIndex tile, Trackdir trackdir, bool forbid_90deg = false);
    00033
    00034 Vehicle *GetTrainForReservation(TileIndex tile, Track track);
    00035
    00043 static inline bool HasReservedTracks(TileIndex tile, TrackBits tracks)
    00044 {
    00045   return (GetReservedTrackbits(tile) & tracks) != TRACK_BIT_NONE;
    00046 }
    00047
    00048 #endif /* PBS_H */