summaryrefslogtreecommitdiff
path: root/src/simulation/elements/IRON.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation/elements/IRON.cpp')
-rw-r--r--src/simulation/elements/IRON.cpp40
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;
}