summaryrefslogtreecommitdiff
path: root/src/rail_map.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-02 22:50:52 +0000
committerrubidium <rubidium@openttd.org>2008-08-02 22:50:52 +0000
commitabc46b1e866b2d079aac7db946213715302c6dfb (patch)
treedfeb569a2bbf1ab6fa93e0ffb7508a68a9644f9c /src/rail_map.h
parentc91c12addeed18baf93a0031d68814a09974bff2 (diff)
downloadopenttd-abc46b1e866b2d079aac7db946213715302c6dfb.tar.xz
(svn r13940) -Add [YAPP]: YAPF is now able to reserve the found path. (michi_cc)
Diffstat (limited to 'src/rail_map.h')
-rw-r--r--src/rail_map.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rail_map.h b/src/rail_map.h
index 805915718..0937da730 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -534,6 +534,21 @@ static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td)));
}
+/**
+ * Is a one-way signal blocking the trackdir? A one-way signal on the
+ * trackdir against will block, but signals on both trackdirs won't.
+ * @param tile the tile to check
+ * @param td the trackdir to check
+ */
+static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
+{
+ return
+ IsTileType(tile, MP_RAILWAY) &&
+ HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
+ !HasSignalOnTrackdir(tile, td) &&
+ IsOnewaySignal(tile, TrackdirToTrack(td));
+}
+
/**
* Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.