From 7f215a6a17cfb3f8373000d73530f56c11708674 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 9 Sep 2018 10:53:02 -0400 Subject: [PATCH] fix particle #0 not being removed from the photons map when moving --- src/simulation/Simulation.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 9d7e08337..80f1d4570 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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=XRES-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;