From daa6af0cc25076d9484d1e1a776853943231f5a7 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Tue, 11 Jan 2011 14:22:24 +0000 Subject: [PATCH] Small fixes and cleanup --- src/elements/aray.c | 4 ++-- src/elements/boyl.c | 6 +++--- src/elements/neut.c | 10 +++++----- src/elements/prti.c | 2 +- src/powder.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/elements/aray.c b/src/elements/aray.c index a931b1ae1..55d6b289a 100644 --- a/src/elements/aray.c +++ b/src/elements/aray.c @@ -55,10 +55,10 @@ int update_ARAY(UPDATE_FUNC_ARGS) { } } } else if (destroy) { - if (parts[r>>8].type==PT_BRAY) { + if ((r&0xFF)==PT_BRAY) { parts[r>>8].life = 1; docontinue = 1; - } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI || parts[r>>8].type==PT_FILT || (parts[r>>8].type==PT_SWCH && parts[r>>8].life>=10)) { + } else if ((r&0xFF)==PT_INWR || (r&0xFF)==PT_ARAY || (r&0xFF)==PT_WIFI || (r&0xFF)==PT_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) { docontinue = 1; } else { docontinue = 0; diff --git a/src/elements/boyl.c b/src/elements/boyl.c index 7486d2eb6..bd54c6f95 100644 --- a/src/elements/boyl.c +++ b/src/elements/boyl.c @@ -12,12 +12,12 @@ int update_BOYL(UPDATE_FUNC_ARGS) { if (y+CELL0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100)) + if (y-CELL>=0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100)) pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL]); - if (x+CELL>0) + if (x-CELL>=0) { pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL-1]); - if (y+CELL>0) + if (y-CELL>=0) pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL-1]); } for (rx=-1; rx<2; rx++) diff --git a/src/elements/neut.c b/src/elements/neut.c index 564b74ca7..42ee9d343 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -54,17 +54,17 @@ int update_NEUT(UPDATE_FUNC_ARGS) { #endif } else if ((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - part_change_type(i,x,y,PT_DUST); + part_change_type(r>>8,x+rx,y+ry,PT_DUST); else if ((r&0xFF)==PT_DYST && 15>(rand()%1000)) - part_change_type(i,x,y,PT_YEST); + part_change_type(r>>8,x+rx,y+ry,PT_YEST); else if ((r&0xFF)==PT_YEST) - part_change_type(i,x,y,PT_DYST); + part_change_type(r>>8,x+rx,y+ry,PT_DYST); else if ((r&0xFF)==PT_WATR && 15>(rand()%100)) part_change_type(r>>8,x+rx,y+ry,PT_DSTW); else if ((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - part_change_type(i,x,y,PT_GOO); + part_change_type(r>>8,x+rx,y+ry,PT_GOO); else if ((r&0xFF)==PT_NITR && 15>(rand()%1000)) - part_change_type(i,x,y,PT_DESL); + part_change_type(r>>8,x+rx,y+ry,PT_DESL); else if ((r&0xFF)==PT_PLNT && 5>(rand()%100)) create_part(r>>8, x+rx, y+ry, PT_WOOD); else if ((r&0xFF)==PT_DESL && 15>(rand()%1000)) diff --git a/src/elements/prti.c b/src/elements/prti.c index a7e2013cb..6cbed9f64 100644 --- a/src/elements/prti.c +++ b/src/elements/prti.c @@ -19,7 +19,7 @@ int update_PRTI(UPDATE_FUNC_ARGS) { portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp; portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype; - if (parts[r>>8].type==PT_SPRK) + if ((r&0xFF)==PT_SPRK) part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype); else kill_part(r>>8); diff --git a/src/powder.c b/src/powder.c index e59fd89aa..829b85672 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1355,7 +1355,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; } if (bmap[y/CELL][x/CELL]==WL_DETECT && emap[y/CELL][x/CELL]<8) - set_emap(nx, ny); + set_emap(x/CELL, y/CELL); vx[y/CELL][x/CELL] = vx[y/CELL][x/CELL]*ptypes[t].airloss + ptypes[t].airdrag*parts[i].vx;