summaryrefslogtreecommitdiff
path: root/bridge_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'bridge_map.c')
-rw-r--r--bridge_map.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bridge_map.c b/bridge_map.c
index dbd6ac3f4..cbb955c37 100644
--- a/bridge_map.c
+++ b/bridge_map.c
@@ -5,6 +5,26 @@
#include "bridge_map.h"
+TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
+{
+ TileIndexDiff delta = TileOffsByDir(dir);
+
+ assert(DiagDirToAxis(dir) == GetBridgeAxis(tile));
+
+ do {
+ tile += delta;
+ } while (!IsBridgeRamp(tile));
+
+ return tile;
+}
+
+
+TileIndex GetSouthernBridgeEnd(TileIndex t)
+{
+ return GetBridgeEnd(t, AxisToDiagDir(GetBridgeAxis(t)));
+}
+
+
TileIndex GetOtherBridgeEnd(TileIndex tile)
{
TileIndexDiff delta = TileOffsByDir(GetBridgeRampDirection(tile));