summaryrefslogtreecommitdiff
path: root/bridge_map.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 /bridge_map.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 'bridge_map.h')
-rw-r--r--bridge_map.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/bridge_map.h b/bridge_map.h
index 9470204e0..40113471b 100644
--- a/bridge_map.h
+++ b/bridge_map.h
@@ -78,10 +78,7 @@ static inline uint GetBridgeType(TileIndex t)
*/
static inline DiagDirection GetBridgeRampDirection(TileIndex t)
{
- /* Heavy wizardry to convert the X/Y (bit 0) + N/S (bit 5) encoding of
- * bridges to a DiagDirection
- */
- return (DiagDirection)((6 - (_m[t].m5 >> 4 & 2) - (_m[t].m5 & 1)) % 4);
+ return ReverseDiagDir(XYNSToDiagDir((Axis)GB(_m[t].m5, 0, 1), GB(_m[t].m5, 5, 1)));
}