Permalink
Browse files

fix crash when particles are out of bounds

  • Loading branch information...
jacob1 committed Apr 28, 2018
1 parent 777cb96 commit be57130c7a30cf453567390a6001fd4acff0582e
Showing with 6 additions and 5 deletions.
  1. +6 −5 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<CELL || y<CELL || 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);

0 comments on commit be57130

Please sign in to comment.