summaryrefslogtreecommitdiff
path: root/direction.h
diff options
context:
space:
mode:
Diffstat (limited to 'direction.h')
-rw-r--r--direction.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/direction.h b/direction.h
index 8f29bdd6c..c7a8498f6 100644
--- a/direction.h
+++ b/direction.h
@@ -102,4 +102,14 @@ static inline Axis DiagDirToAxis(DiagDirection d)
return (Axis)(d & 1);
}
+
+/*
+ * Converts an Axis to a DiagDirection
+ * Points always in the positive direction, i.e. S[EW]
+ */
+static inline DiagDirection AxisToDiagDir(Axis a)
+{
+ return (DiagDirection)(2 - a);
+}
+
#endif