tron@2186: /* $Id$ */ tron@2186: hackykid@2008: #ifndef PBS_H hackykid@2008: #define PBS_H hackykid@2008: hackykid@2008: /** @file pbs.h Path-Based-Signalling header file hackykid@2008: * @see pbs.c */ hackykid@2008: hackykid@2008: #include "vehicle.h" hackykid@2008: #include "map.h" hackykid@2008: #include "rail.h" hackykid@2008: hackykid@2008: /** hackykid@2008: * constants used for pbs_mode argument of npf-functions hackykid@2008: */ hackykid@2008: enum pbs_modes { hackykid@2008: PBS_MODE_NONE = 0, // no pbs hackykid@2008: PBS_MODE_GREEN = 1, // look for green exit signal from pbs block hackykid@2008: PBS_MODE_ANY = 2, // look for any exit signal from block hackykid@2008: }; hackykid@2008: hackykid@2008: /** hackykid@2008: * constants used for v->u.rail.pbs_status hackykid@2008: */ hackykid@2008: enum PBSStatus { hackykid@2008: PBS_STAT_NONE = 0, hackykid@2008: PBS_STAT_HAS_PATH = 1, hackykid@2008: PBS_STAT_NEED_PATH = 2, hackykid@2008: }; hackykid@2008: hackykid@2008: hackykid@2008: void PBSReserveTrack(TileIndex tile, Track track); hackykid@2008: /**< hackykid@2008: * Marks a track as reserved. hackykid@2008: * @param tile The tile of the track. hackykid@2008: * @param track The track to reserve, valid values 0-5. hackykid@2008: */ hackykid@2008: hackykid@2008: byte PBSTileReserved(TileIndex tile); hackykid@2008: /**< hackykid@2008: * Check which tracks are reserved on a tile. hackykid@2008: * @param tile The tile which you want to check. hackykid@2008: * @return The tracks reserved on that tile, each of the bits 0-5 is set when the corresponding track is reserved. hackykid@2008: */ hackykid@2008: hackykid@2008: uint16 PBSTileUnavail(TileIndex tile); hackykid@2008: /**< hackykid@2008: * Check which trackdirs are unavailable due to reserved tracks on a tile. hackykid@2008: * @param tile The tile which you want to check. hackykid@2008: * @return The tracks reserved on that tile, each of the bits 0-5,8-13 is set when the corresponding trackdir is unavailable. hackykid@2008: */ hackykid@2008: hackykid@2008: void PBSClearTrack(TileIndex tile, Track track); hackykid@2008: /**< hackykid@2008: * Unreserves a track. hackykid@2008: * @param tile The tile of the track. hackykid@2008: * @param track The track to unreserve, valid values 0-5. hackykid@2008: */ hackykid@2008: hackykid@2115: void PBSClearPath(TileIndex tile, Trackdir trackdir, TileIndex end_tile, Trackdir end_trackdir); hackykid@2008: /**< hackykid@2008: * Follows a planned(reserved) path, and unreserves the tracks. hackykid@2008: * @param tile The tile on which the path starts hackykid@2008: * @param trackdir The trackdirection in which the path starts hackykid@2115: * @param end_tile The tile on which the path ends hackykid@2115: * @param end_trackdir The trackdirection in which the path ends hackykid@2008: */ hackykid@2008: hackykid@2008: bool PBSIsPbsSignal(TileIndex tile, Trackdir trackdir); hackykid@2008: /**< hackykid@2008: * Checks if there are pbs signals on a track. hackykid@2008: * @param tile The tile you want to check hackykid@2008: * @param trackdir The trackdir you want to check hackykid@2008: * @return True when there are pbs signals on that tile hackykid@2008: */ hackykid@2008: hackykid@2164: bool PBSIsPbsSegment(uint tile, Trackdir trackdir); hackykid@2008: /**< hackykid@2164: * Checks if a signal/depot leads to a pbs block. hackykid@2164: * This means that the block needs to have at least 1 signal, and that all signals in it need to be pbs signals. hackykid@2164: * @param tile The tile to check hackykid@2164: * @param trackdir The direction in which to check hackykid@2164: * @return True when the depot is inside a pbs block hackykid@2008: */ hackykid@2008: Darkvater@2436: #endif /* PBS_H */