summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-11 14:22:24 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-11 21:17:02 (GMT)
commitdaa6af0cc25076d9484d1e1a776853943231f5a7 (patch)
treea187b78d11aba690c59cd27322fa57ceaa1876ba /src/elements
parent4006bdf4c22564e916092d6d63ae63d1fa6bc5b5 (diff)
downloadpowder-daa6af0cc25076d9484d1e1a776853943231f5a7.zip
powder-daa6af0cc25076d9484d1e1a776853943231f5a7.tar.gz
Small fixes and cleanup
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/aray.c4
-rw-r--r--src/elements/boyl.c6
-rw-r--r--src/elements/neut.c10
-rw-r--r--src/elements/prti.c2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/elements/aray.c b/src/elements/aray.c
index a931b1a..55d6b28 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 7486d2e..bd54c6f 100644
--- a/src/elements/boyl.c
+++ b/src/elements/boyl.c
@@ -12,12 +12,12 @@ int update_BOYL(UPDATE_FUNC_ARGS) {
if (y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL+1]);
}
- if (y+CELL>0 && 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 564b74c..42ee9d3 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 a7e2013..6cbed9f 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);