From 68bb40976f4907f0475e501248c7ede670600732 Mon Sep 17 00:00:00 2001 From: dP Date: Wed, 31 Mar 2021 01:11:40 +0300 Subject: [PATCH] Fix crash when extending polyrail snap points over the bridge or tunnel --- src/viewport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewport.cpp b/src/viewport.cpp index 9e2a7dcc4a..6a12551c6d 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -3975,7 +3975,7 @@ static LineSnapPoint LineSnapPointAtRailTrackEndpoint(TileIndex tile, DiagDirect TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, INVALID_DIAGDIR)) == AxisToTrackBits(DiagDirToAxis(exit_dir)) && IsTileOwner(tile, _local_company)) { /* Check if this is a tunnel/bridge and move the tile to the other end if so. */ - if (IsTileType(tile, MP_TUNNELBRIDGE)) tile = GetOtherTunnelBridgeEnd(tile); + if (IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeDirection(tile) == exit_dir) tile = GetOtherTunnelBridgeEnd(tile); LineSnapPoint ex = LineSnapPointAtRailTrackEndpoint(tile, exit_dir, false, extended); if (!bidirectional) return ex; // if we are interested in forward direction only then return just the extended point *extended = ex; // otherwise return two points, extended with forward direction and base with reverse direction