Skip to content

Commit

Permalink
fix particle #0 not being removed from the photons map when moving
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Sep 9, 2018
1 parent 3707ecd commit 7f215a6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/simulation/Simulation.cpp
Expand Up @@ -2726,9 +2726,12 @@ int Simulation::do_move(int i, int x, int y, float nxf, float nyf)
parts[i].y = nyf;
if (ny!=y || nx!=x)
{
if (ID(pmap[y][x])==i) pmap[y][x] = 0;
else if (ID(photons[y][x])==i) photons[y][x] = 0;
if (nx<CELL || nx>=XRES-CELL || ny<CELL || ny>=YRES-CELL)//kill_part if particle is out of bounds
if (ID(pmap[y][x]) == i)
pmap[y][x] = 0;
if (ID(photons[y][x]) == i)
photons[y][x] = 0;
// kill_part if particle is out of bounds
if (nx < CELL || nx >= XRES - CELL || ny < CELL || ny >= YRES - CELL)
{
kill_part(i);
return -1;
Expand Down

0 comments on commit 7f215a6

Please sign in to comment.