summaryrefslogtreecommitdiff
path: root/src/simulation/elements/PCLN.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-13 00:37:32 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-13 00:37:32 (GMT)
commit0cb47ab93cb7474f24c867ec0b9b9c9ac2dbf487 (patch)
tree316f4236cae91cbaf469c5a295e060ab5f1ce84d /src/simulation/elements/PCLN.cpp
parentf0778c20332cc837a0d05996292a6e5e6265a9d7 (diff)
downloadpowder-0cb47ab93cb7474f24c867ec0b9b9c9ac2dbf487.zip
powder-0cb47ab93cb7474f24c867ec0b9b9c9ac2dbf487.tar.gz
TPT: Remember ctype when cloning lava
Diffstat (limited to 'src/simulation/elements/PCLN.cpp')
-rw-r--r--src/simulation/elements/PCLN.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/simulation/elements/PCLN.cpp b/src/simulation/elements/PCLN.cpp
index 14991b5..41701bc 100644
--- a/src/simulation/elements/PCLN.cpp
+++ b/src/simulation/elements/PCLN.cpp
@@ -91,7 +91,7 @@ int Element_PCLN::update(UPDATE_FUNC_ARGS)
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
{
parts[i].ctype = r&0xFF;
- if ((r&0xFF)==PT_LIFE)
+ if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
parts[i].tmp = parts[r>>8].ctype;
}
}
@@ -125,8 +125,15 @@ int Element_PCLN::update(UPDATE_FUNC_ARGS)
sim->create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
}
}
- } else {
- sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ }
+ else
+ {
+ int np = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ if (np>=0)
+ {
+ if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && sim->elements[parts[i].tmp].HighTemperatureTransition==PT_LAVA)
+ parts[np].ctype = parts[i].tmp;
+ }
}
}
return 0;
@@ -144,4 +151,4 @@ int Element_PCLN::graphics(GRAPHICS_FUNC_ARGS)
}
-Element_PCLN::~Element_PCLN() {} \ No newline at end of file
+Element_PCLN::~Element_PCLN() {}