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 cee9ab73a..fcc6771be 100644
--- a/direction.h
+++ b/direction.h
@@ -113,6 +113,16 @@ static inline DiagDirection AxisToDiagDir(Axis a)
return (DiagDirection)(2 - a);
}
+/**
+ * Convert an axis and a flag for north/south into a DiagDirection
+ * @param ns north -> 0, south -> 1
+ */
+static inline DiagDirection XYNSToDiagDir(Axis xy, uint ns)
+{
+ return (DiagDirection)(xy * 3 ^ ns * 2);
+}
+
+
static inline bool IsValidDiagDirection(DiagDirection d)
{
return d < DIAGDIR_END;