From 47104e6981b920c03cb4b91ce7df012141f2c71c Mon Sep 17 00:00:00 2001 From: keldorkatarn Date: Mon, 9 Apr 2018 20:05:03 +0200 Subject: [PATCH] Fix assertion failure when trams do a short turnaround in a tunnel mouth --- src/tunnelbridge_cmd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index e002b48f0..1d408d7b8 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -2134,6 +2134,8 @@ static const byte TUNNEL_SOUND_FRAME = 1; */ extern const byte _tunnel_visibility_frame[DIAGDIR_END] = {12, 8, 8, 12}; +extern const byte _tunnel_turnaround_pre_visibility_frame[DIAGDIR_END] = { 31, 27, 27, 31 }; + static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y) { int z = GetSlopePixelZ(x, y) - v->z_pos; @@ -2184,7 +2186,8 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti if (rv->state != RVSB_WORMHOLE && dir == vdir) { if (frame == _tunnel_visibility_frame[dir]) { /* Frame should be equal to the next frame number in the RV's movement */ - assert(frame == rv->frame + 1); + assert_msg(frame == rv->frame + 1 || rv->frame == _tunnel_turnaround_pre_visibility_frame[dir], + +"frame: %u, rv->frame: %u, dir: %u, _tunnel_turnaround_pre_visibility_frame[dir]: %u", frame, rv->frame, dir, _tunnel_turnaround_pre_visibility_frame[dir]); rv->tile = tile; rv->state = RVSB_WORMHOLE; if (Tunnel::GetByTile(tile)->is_chunnel) SetBit(rv->gv_flags, GVF_CHUNNEL_BIT); -- 2.11.4.GIT