summaryrefslogtreecommitdiff
path: root/direction.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-04 16:04:15 +0000
committertron <tron@openttd.org>2006-06-04 16:04:15 +0000
commitfa740023567157cf18d4dd06880307e7b08b7c77 (patch)
tree7fafd1f3b5f9dd18acaf05ec2212fd5099f44243 /direction.h
parent479317b1eb85ba94491e2fd6d330f38fb25e02ea (diff)
downloadopenttd-fa740023567157cf18d4dd06880307e7b08b7c77.tar.xz
(svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots
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;