Fix flood_parts crashes

Crashes due to infinite recursion in flood_parts, which seemed to be caused by
the pmap being incorrect.
This commit is contained in:
jacksonmj 2011-02-06 17:16:49 +00:00
parent 21d0dd0ca2
commit b7e50f521c

View File

@ -253,11 +253,9 @@ int try_move(int i, int x, int y, int nx, int ny)
parts[e].x += x-nx;
parts[e].y += y-ny;
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type;
}
pmap[ny][nx] = (i<<8)|parts[i].type;
pmap[y][x] = r;
return 1;
}
@ -2030,11 +2028,19 @@ killed:
}
nx = (int)(parts[i].x+0.5f);
ny = (int)(parts[i].y+0.5f);
if (ny!=y || nx!=x)
{
if ((pmap[y][x]>>8)==i) pmap[y][x] = 0;
if (nx<CELL || nx>=XRES-CELL || ny<CELL || ny>=YRES-CELL)
{
kill_part(i);
continue;
}
if (t==PT_PHOT)
photons[ny][nx] = t|(i<<8);
else
pmap[ny][nx] = t|(i<<8);
}
}
if (framerender) {
framerender = 0;