summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-12-06 20:25:13 (GMT)
committer Simon <simon@hardwired.org.uk>2010-12-06 20:25:13 (GMT)
commit3cf8bb93c77ccc09c294bbad5d69e88a83035c44 (patch)
tree94e820be40c3e73330dd66338c77fe71acb1d656 /src
parente629908945576935b794b6c6219451bef8dc2132 (diff)
downloadpowder-3cf8bb93c77ccc09c294bbad5d69e88a83035c44.zip
powder-3cf8bb93c77ccc09c294bbad5d69e88a83035c44.tar.gz
Fix ARAYs scanning off screen, also removed warnings from makefile
Diffstat (limited to 'src')
-rw-r--r--src/powder.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/powder.c b/src/powder.c
index 275f923..12a2e78 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1833,6 +1833,9 @@ void update_particles_i(pixel *vid, int start, int inc)
if((r&0xFF)==PT_SPRK){
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
for (int docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
+ if(!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)){
+ break;
+ }
r = pmap[y+nyi+nyy][x+nxi+nxx];
if(!((r>>8)>=NPART)) {
if(!r){
@@ -1841,8 +1844,8 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[nr].tmp = 2;
parts[nr].life = 2;
}
- } else if(!((r>>8)>=NPART || !r)) {
- if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0&&!destroy){
+ } else if(!destroy) {
+ if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0){
if(nyy!=0 || nxx!=0){
parts[r>>8].type = PT_BRAY;
parts[r>>8].life = 1020;
@@ -1850,15 +1853,18 @@ void update_particles_i(pixel *vid, int start, int inc)
}
docontinue = 0;
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
- parts[r>>8].life = destroy?1:1020;
- docontinue = 1;
- } else if(!destroy) {
+ //parts[r>>8].life = 1020;
+ //docontinue = 1;
+ } else {
if(nyy!=0 || nxx!=0){
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}
docontinue = 0;
- } else {
- docontinue = 0;
+ }
+ } else if(destroy) {
+ if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
+ parts[r>>8].life = 1;
+ docontinue = 1;
}
}
}