From 0ed8d0a0be2556f2337ec0acc2cf4f7e67bfb5b3 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 23 Oct 2021 00:51:50 -0400 Subject: [PATCH] Fix flood_water movement cancel check This fixes a crash with water equalization on, with loop mode enabled, when there are high velocity particles near the edges. This can be occasionally reproduced with id:2800901 The water was moved to a new position and pmap updated, but the movement code continued, assuming water was at its old position. pmap for the WATR's old position won't be cleared once it moves, leaving a stale entry. If a particle then looks up the water in that location and tries to swap positions, this can cause a crash at the end of try_move --- src/simulation/Simulation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 2d21de53e..53cdc355e 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -4441,7 +4441,7 @@ killed: // Checking stagnant is cool, but then it doesn't update when you change it later. if (water_equal_test && elements[t].Falldown == 2 && RNG::Ref().chance(1, 200)) { - if (!flood_water(x, y, i)) + if (flood_water(x, y, i)) goto movedone; } // liquids and powders