fix particle #0 not being removed from the photons map when moving

This commit is contained in:
jacob1
2018-09-09 10:53:02 -04:00
parent 3707ecd563
commit 7f215a6a17

View File

@@ -2726,9 +2726,12 @@ int Simulation::do_move(int i, int x, int y, float nxf, float nyf)
parts[i].y = nyf; parts[i].y = nyf;
if (ny!=y || nx!=x) if (ny!=y || nx!=x)
{ {
if (ID(pmap[y][x])==i) pmap[y][x] = 0; if (ID(pmap[y][x]) == i)
else if (ID(photons[y][x])==i) photons[y][x] = 0; pmap[y][x] = 0;
if (nx<CELL || nx>=XRES-CELL || ny<CELL || ny>=YRES-CELL)//kill_part if particle is out of bounds 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); kill_part(i);
return -1; return -1;