diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-10 14:41:03 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-10 14:41:03 (GMT) |
| commit | 54f9f872b9e4d5a0086d6de104e84d43b125c349 (patch) | |
| tree | b567fb9d3710acbce22f8193bfe2585bb2988bed /src/elements/coal.c | |
| parent | 855281295fbc23366e8b84d7c8e55816d6f47a87 (diff) | |
| download | powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.zip powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.tar.gz | |
Finish update function cleanup
Diffstat (limited to 'src/elements/coal.c')
| -rw-r--r-- | src/elements/coal.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/elements/coal.c b/src/elements/coal.c index 58ba48c..8793eb4 100644 --- a/src/elements/coal.c +++ b/src/elements/coal.c @@ -1,11 +1,9 @@ #include <powder.h> int update_COAL(UPDATE_FUNC_ARGS) { - int r; + int r, rx, ry; if (parts[i].life<=0) { - parts[i].type = PT_NONE; - kill_part(i); - create_part(-1, x, y, PT_FIRE); + create_part(i, x, y, PT_FIRE); return 1; } else if (parts[i].life < 100) { parts[i].life--; @@ -16,17 +14,14 @@ int update_COAL(UPDATE_FUNC_ARGS) { else if (parts[i].tmp<40&&parts[i].tmp>0) parts[i].tmp--; else if (parts[i].tmp<=0) { - parts[i].type = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_BCOL); + create_part(i, x, y, PT_BCOL); return 1; } - for (nx=-2; nx<3; nx++) - for (ny=-2; ny<3; ny++) - if (x+nx>=0 && y+ny>0 && - x+nx<XRES && y+ny<YRES && (nx || ny)) + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { - r = pmap[y+ny][x+nx]; + r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || !r) continue; if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) |
