summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tunnelbridge_map.h')
-rw-r--r--src/tunnelbridge_map.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tunnelbridge_map.h b/src/tunnelbridge_map.h
index e9cbe0945..47266442f 100644
--- a/src/tunnelbridge_map.h
+++ b/src/tunnelbridge_map.h
@@ -8,6 +8,8 @@
#include "direction_func.h"
#include "core/bitmath_func.hpp"
#include "tile_map.h"
+#include "bridge_map.h"
+#include "tunnel_map.h"
/**
@@ -63,4 +65,16 @@ static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
SB(_m[t].m4, 7, 1, snow_or_desert);
}
+/**
+ * Determines type of the wormhole and returns its other end
+ * @param t one end
+ * @pre IsTileType(t, MP_TUNNELBRIDGE)
+ * @return other end
+ */
+static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
+{
+ assert(IsTileType(t, MP_TUNNELBRIDGE));
+ return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
+}
+
#endif /* TUNNELBRIDGE_MAP_H */