summaryrefslogtreecommitdiff
path: root/src/pbs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pbs.h')
-rw-r--r--src/pbs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pbs.h b/src/pbs.h
index 4103f1ebf..d4b87b8e6 100644
--- a/src/pbs.h
+++ b/src/pbs.h
@@ -8,6 +8,7 @@
#include "tile_type.h"
#include "direction_type.h"
#include "track_type.h"
+#include "vehicle_type.h"
TrackBits GetReservedTrackbits(TileIndex t);
@@ -16,6 +17,20 @@ void SetRailwayStationPlatformReservation(TileIndex start, DiagDirection dir, bo
bool TryReserveRailTrack(TileIndex tile, Track t);
void UnreserveRailTrack(TileIndex tile, Track t);
+/** This struct contains information about the end of a reserved path. */
+struct PBSTileInfo {
+ TileIndex tile; ///< Tile the path ends, INVALID_TILE if no valid path was found.
+ Trackdir trackdir; ///< The reserved trackdir on the tile.
+ bool okay; ///< True if tile is a safe wairing position, false otherwise.
+
+ PBSTileInfo() : tile(INVALID_TILE), trackdir(INVALID_TRACKDIR), okay(false) {}
+ PBSTileInfo(TileIndex _t, Trackdir _td, bool _okay) : tile(_t), trackdir(_td), okay(_okay) {}
+};
+
+PBSTileInfo FollowTrainReservation(const Vehicle *v);
+bool IsSafeWaitingPosition(const Vehicle *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg = false);
+bool IsWaitingPositionFree(const Vehicle *v, TileIndex tile, Trackdir trackdir, bool forbid_90deg = false);
+
/**
* Check whether some of tracks is reserved on a tile.
*