From 102c55bc57000f09a24a1dd7a1d6836c5abb3a63 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 13 Dec 2017 20:44:12 +0000 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 fd08e6d788..af4ad9a626 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -2137,6 +2137,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; @@ -2187,7 +2189,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->cur_image_valid_dir = INVALID_DIR; rv->state = RVSB_WORMHOLE;