summaryrefslogtreecommitdiff
path: root/src/simulation/elements/SLTW.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation/elements/SLTW.cpp')
-rw-r--r--src/simulation/elements/SLTW.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/simulation/elements/SLTW.cpp b/src/simulation/elements/SLTW.cpp
index 1a7586f..7ff1b0b 100644
--- a/src/simulation/elements/SLTW.cpp
+++ b/src/simulation/elements/SLTW.cpp
@@ -55,24 +55,37 @@ int Element_SLTW::update(UPDATE_FUNC_ARGS)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- if ((r&0xFF)==PT_SALT && 1>(rand()%10000))
- sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
- if ((r&0xFF)==PT_PLNT&&5>(rand()%1000))
- sim->kill_part(r>>8);
- if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && 1>(rand()%500))
+ switch (r&0xFF)
{
- sim->part_change_type(i,x,y,PT_FIRE);
- parts[i].life = 4;
- parts[i].ctype = PT_WATR;
- }
- if ((r&0xFF)==PT_FIRE && parts[r>>8].ctype!=PT_WATR){
- sim->kill_part(r>>8);
- if(1>(rand()%150)){
- sim->kill_part(i);
- return 1;
+ case PT_SALT:
+ if (!(rand()%10000))
+ sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
+ break;
+ case PT_PLNT:
+ if (!(rand()%200))
+ sim->kill_part(r>>8);
+ break;
+ case PT_RBDM:
+ case PT_LRBD:
+ if ((sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%500))
+ {
+ sim->part_change_type(i,x,y,PT_FIRE);
+ parts[i].life = 4;
+ parts[i].ctype = PT_WATR;
}
+ break;
+ case PT_FIRE:
+ if (parts[r>>8].ctype!=PT_WATR)
+ {
+ sim->kill_part(r>>8);
+ if(!(rand()%150)){
+ sim->kill_part(i);
+ return 1;
+ }
+ }
+ break;
+ default:
+ continue;
}
}
return 0;