From be57130c7a30cf453567390a6001fd4acff0582e Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 28 Apr 2018 00:27:03 -0400 Subject: [PATCH] fix crash when particles are out of bounds --- src/simulation/Simulation.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index aeeff3dc7..c73ccd945 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -3667,11 +3667,6 @@ void Simulation::UpdateParticles(int start, int end) x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - // Make sure that STASIS'd particles don't tick. - if (bmap[y/CELL][x/CELL] == WL_STASIS && emap[y/CELL][x/CELL]<8) { - continue; - } - //this kills any particle out of the screen, or in a wall where it isn't supposed to go if (x=XRES-CELL || y>=YRES-CELL || (bmap[y/CELL][x/CELL] && @@ -3689,6 +3684,12 @@ void Simulation::UpdateParticles(int start, int end) kill_part(i); continue; } + + // Make sure that STASIS'd particles don't tick. + if (bmap[y/CELL][x/CELL] == WL_STASIS && emap[y/CELL][x/CELL]<8) { + continue; + } + if (bmap[y/CELL][x/CELL]==WL_DETECT && emap[y/CELL][x/CELL]<8) set_emap(x/CELL, y/CELL);