summaryrefslogtreecommitdiff
path: root/src/track_func.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/track_func.h')
-rw-r--r--src/track_func.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/track_func.h b/src/track_func.h
index 32a872b61..813f211b1 100644
--- a/src/track_func.h
+++ b/src/track_func.h
@@ -494,4 +494,24 @@ static inline bool TracksOverlap(TrackBits bits)
return bits != TRACK_BIT_HORZ && bits != TRACK_BIT_VERT;
}
+/**
+ * Checks whether the trackdir means that we are reversing.
+ * @param dir the trackdir to check
+ * @return true if it is a reversing road trackdir
+ */
+static inline bool IsReversingRoadTrackdir(Trackdir dir)
+{
+ return (dir & 0x07) >= 6;
+}
+
+/**
+ * Checks whether the given trackdir is a straight road
+ * @param dir the trackdir to check
+ * @return true if it is a straight road trackdir
+ */
+static inline bool IsStraightRoadTrackdir(Trackdir dir)
+{
+ return (dir & 0x06) == 0;
+}
+
#endif /* RAIL_H */