diff options
| author | cracker64 <cracker642@gmail.com> | 2013-03-01 05:41:53 (GMT) |
|---|---|---|
| committer | cracker64 <cracker642@gmail.com> | 2013-03-01 05:41:53 (GMT) |
| commit | 0d70547cf059b5bd0a7a4a0acd9251fb94c6115e (patch) | |
| tree | 99a0b212eeecee83662d963da052b439375acbf3 /src/simulation/elements/IRON.cpp | |
| parent | 5873d6958641af21b92fcb039d26c336331f19e7 (diff) | |
| download | powder-0d70547cf059b5bd0a7a4a0acd9251fb94c6115e.zip powder-0d70547cf059b5bd0a7a4a0acd9251fb94c6115e.tar.gz | |
More fixes to fix fixes and new fixes to fix stuff.
Diffstat (limited to 'src/simulation/elements/IRON.cpp')
| -rw-r--r-- | src/simulation/elements/IRON.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/simulation/elements/IRON.cpp b/src/simulation/elements/IRON.cpp index b742b30..9614cd7 100644 --- a/src/simulation/elements/IRON.cpp +++ b/src/simulation/elements/IRON.cpp @@ -48,28 +48,40 @@ Element_IRON::Element_IRON() //#TPT-Directive ElementHeader Element_IRON static int update(UPDATE_FUNC_ARGS) int Element_IRON::update(UPDATE_FUNC_ARGS) - { - int r, rx, ry, rt; +{ + int r, rx, ry, rt; for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { r = pmap[y+ry][x+rx]; - if (!r) - continue; - rt = r&0xFF; - if ((!(parts[i].life)) && - ((rt == PT_SALT && !(rand()%47)) || - (rt == PT_SLTW && !(rand()%67)) || - (rt == PT_WATR && !(rand()%1200)) || - (rt == PT_O2 && !(rand()%250)) || - (rt == PT_LO2)) - ) + switch (r&0xFF) { - sim->part_change_type(i,x,y,PT_BMTL); - parts[i].tmp=(rand()/(RAND_MAX/10))+20; + case PT_SALT: + if (!(parts[i].life) && !(rand()%47)) + goto succ; + break; + case PT_SLTW: + if (!(parts[i].life) && !(rand()%67)) + goto succ; + break; + case PT_WATR: + if (!(parts[i].life) && !(rand()%1200)) + goto succ; + break; + case PT_O2: + if (!(parts[i].life) && !(rand()%250)) + goto succ; + break; + case PT_LO2: + goto succ; + default: + break; } } +succ: + sim->part_change_type(i,x,y,PT_BMTL); + parts[i].tmp=(rand()%10)+20; return 0; } |
