Fix crash with spark flood fill

This commit is contained in:
jacob1 2014-05-22 11:19:56 -04:00
parent 5e02073a2f
commit 42f5ec9f36

View File

@ -1447,7 +1447,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
if (cm==-1) if (cm==-1)
{ {
//if initial flood point is out of bounds, do nothing //if initial flood point is out of bounds, do nothing
if (c != 0 && (x < CELL || x >= XRES-CELL || y < CELL || y >= YRES-CELL)) if (c != 0 && (x < CELL || x >= XRES-CELL || y < CELL || y >= YRES-CELL || c == PT_SPRK))
return 1; return 1;
else if (x < 0 || x >= XRES || y < 0 || y >= YRES) else if (x < 0 || x >= XRES || y < 0 || y >= YRES)
return 1; return 1;
@ -1455,6 +1455,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
{ {
cm = pmap[y][x]&0xFF; cm = pmap[y][x]&0xFF;
if (!cm) if (!cm)
{
cm = photons[y][x]&0xFF; cm = photons[y][x]&0xFF;
if (!cm) if (!cm)
{ {
@ -1464,6 +1465,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
return -1; return -1;
} }
} }
}
else else
cm = 0; cm = 0;
} }