Skip to content

Commit

Permalink
fix crash when particles are out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Apr 28, 2018
1 parent 777cb96 commit be57130
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/simulation/Simulation.cpp
Expand Up @@ -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] &&
Expand All @@ -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);

Expand Down

0 comments on commit be57130

Please sign in to comment.