summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-02-06 17:16:49 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-02-06 17:16:49 (GMT)
commitb7e50f521c7163b21488c030be3d7bed4cba5807 (patch)
tree6ce9daabc0b2edbd8b8d398b01cc38c47d594918 /src
parent21d0dd0ca2191df7f1ae46f3cd8c4d081e18e603 (diff)
downloadpowder-b7e50f521c7163b21488c030be3d7bed4cba5807.zip
powder-b7e50f521c7163b21488c030be3d7bed4cba5807.tar.gz
Fix flood_parts crashes
Crashes due to infinite recursion in flood_parts, which seemed to be caused by the pmap being incorrect.
Diffstat (limited to 'src')
-rw-r--r--src/powder.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/powder.c b/src/powder.c
index 4d8ba45..8348fb0 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -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,10 +2028,18 @@ killed:
}
nx = (int)(parts[i].x+0.5f);
ny = (int)(parts[i].y+0.5f);
- if (nx<CELL || nx>=XRES-CELL || ny<CELL || ny>=YRES-CELL)
+ if (ny!=y || nx!=x)
{
- kill_part(i);
- continue;
+ 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) {