summaryrefslogtreecommitdiff
path: root/src/simulation/elements/FIRE.cpp
diff options
context:
space:
mode:
authorSaveliy Skresanov <savask@yandex.ru>2013-03-16 16:03:02 (GMT)
committer Saveliy Skresanov <savask@yandex.ru>2013-03-16 16:03:02 (GMT)
commit43974d8537195f5dabc239562b35874335b949f7 (patch)
tree8a3e613de9f265c99fbf9ffde5f3f142eb575721 /src/simulation/elements/FIRE.cpp
parentd383d6d7e5e1d3ca0856c02ebbcea5e9b8b2ff4e (diff)
downloadpowder-43974d8537195f5dabc239562b35874335b949f7.zip
powder-43974d8537195f5dabc239562b35874335b949f7.tar.gz
Narrowed loops for all elements in the first list.
Probabilities might be messed up a bit, I'm not sure.
Diffstat (limited to 'src/simulation/elements/FIRE.cpp')
-rw-r--r--src/simulation/elements/FIRE.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/simulation/elements/FIRE.cpp b/src/simulation/elements/FIRE.cpp
index 6e3e01a..2fcf167 100644
--- a/src/simulation/elements/FIRE.cpp
+++ b/src/simulation/elements/FIRE.cpp
@@ -95,6 +95,42 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
if (sim->bmap[(y+ry)/CELL][(x+rx)/CELL] && sim->bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
continue;
rt = r&0xFF;
+
+ //THRM burning
+ if (rt==PT_THRM && (t==PT_FIRE || t==PT_PLSM || t==PT_LAVA))
+ {
+ if (!(rand()%500)) {
+ sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
+ parts[r>>8].ctype = PT_BMTL;
+ parts[r>>8].temp = 3500.0f;
+ sim->pv[(y+ry)/CELL][(x+rx)/CELL] += 50.0f;
+ } else {
+ sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
+ parts[r>>8].life = 400;
+ parts[r>>8].ctype = PT_THRM;
+ parts[r>>8].temp = 3500.0f;
+ parts[r>>8].tmp = 20;
+ }
+ continue;
+ }
+
+ if ((rt==PT_COAL) || (rt==PT_BCOL))
+ {
+ if ((t==PT_FIRE || t==PT_PLSM))
+ {
+ if (parts[r>>8].life>100 && !(rand()%500)) {
+ parts[r>>8].life = 99;
+ }
+ }
+ else if (t==PT_LAVA)
+ {
+ if (parts[i].ctype == PT_IRON && !(rand()%500)) {
+ parts[i].ctype = PT_METL;
+ sim->kill_part(r>>8);
+ }
+ }
+ }
+
if ((surround_space || sim->elements[rt].Explosive) &&
(t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL)) &&
(t!=PT_PHOT || rt!=PT_INSL) &&
@@ -126,6 +162,43 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
if (sim->bmap[(y+ry)/CELL][(x+rx)/CELL] && sim->bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
continue;
rt = r&0xFF;
+
+ //THRM burning
+ if (rt==PT_THRM && (t==PT_FIRE || t==PT_PLSM || t==PT_LAVA))
+ {
+ if (!(rand()%500)) {
+ sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
+ parts[r>>8].ctype = PT_BMTL;
+ parts[r>>8].temp = 3500.0f;
+ sim->pv[(y+ry)/CELL][(x+rx)/CELL] += 50.0f;
+ } else {
+ sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
+ parts[r>>8].life = 400;
+ parts[r>>8].ctype = PT_THRM;
+ parts[r>>8].temp = 3500.0f;
+ parts[r>>8].tmp = 20;
+ }
+ continue;
+ }
+
+ if ((rt==PT_COAL) || (rt==PT_BCOL))
+ {
+ if ((t==PT_FIRE || t==PT_PLSM))
+ {
+ if (parts[r>>8].life>100 && !(rand()%500)) {
+ parts[r>>8].life = 99;
+ }
+ }
+ else if (t==PT_LAVA)
+ {
+ if (parts[i].ctype == PT_IRON && !(rand()%500)) {
+ parts[i].ctype = PT_METL;
+ sim->kill_part(r>>8);
+ }
+ }
+ }
+
+
lpv = (int)sim->pv[(y+ry)/CELL][(x+rx)/CELL];
if (lpv < 1) lpv = 1;
if (t!=PT_SPRK && sim->elements[rt].Meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&sim->elements[rt].Meltable*lpv>(rand()%1000))