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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/track_func.h b/src/track_func.h
index e6591212a..144ea03e8 100644
--- a/src/track_func.h
+++ b/src/track_func.h
@@ -198,6 +198,21 @@ static inline bool IsValidTrackdir(Trackdir trackdir)
*/
/**
+ * Find the opposite track to a given track.
+ *
+ * TRACK_LOWER -> TRACK_UPPER and vice versa, likewise for left/right.
+ * TRACK_X is mapped to TRACK_Y and reversed.
+ *
+ * @param t the track to convert
+ * @return the opposite track
+ */
+static inline Track TrackToOppositeTrack(Track t)
+{
+ assert(t != INVALID_TRACK);
+ return (Track)(t ^ 1);
+}
+
+/**
* Maps a trackdir to the reverse trackdir.
*
* Returns the reverse trackdir of a Trackdir value. The reverse trackdir