summaryrefslogtreecommitdiff
path: root/bridge_map.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-15 16:44:50 +0000
committertron <tron@openttd.org>2006-03-15 16:44:50 +0000
commit626109f3f967a9ab4918808351fde640aafaa27b (patch)
tree64e50bf99a33465decab370d13970df72c292068 /bridge_map.c
parentbd5def0092b9373a137aa2f37db76152bc839444 (diff)
downloadopenttd-626109f3f967a9ab4918808351fde640aafaa27b.tar.xz
(svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
Diffstat (limited to 'bridge_map.c')
-rw-r--r--bridge_map.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/bridge_map.c b/bridge_map.c
new file mode 100644
index 000000000..dbd6ac3f4
--- /dev/null
+++ b/bridge_map.c
@@ -0,0 +1,17 @@
+/* $Id$ */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "bridge_map.h"
+
+
+TileIndex GetOtherBridgeEnd(TileIndex tile)
+{
+ TileIndexDiff delta = TileOffsByDir(GetBridgeRampDirection(tile));
+
+ do {
+ tile += delta;
+ } while (!IsBridgeRamp(tile));
+
+ return tile;
+}