summaryrefslogtreecommitdiff
path: root/src/elements/pcln.c
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-07-22 21:06:07 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-07-24 12:10:43 (GMT)
commit89cc8d4ded6cf96941520e5d0097224f60b79929 (patch)
tree31adc041d90200bdc0e0a93e3a39aa882142026e /src/elements/pcln.c
parent7ed0255f04f494e914b724cf5614f4f1d343069a (diff)
downloadpowder-89cc8d4ded6cf96941520e5d0097224f60b79929.zip
powder-89cc8d4ded6cf96941520e5d0097224f60b79929.tar.gz
Fix life cloning
Diffstat (limited to 'src/elements/pcln.c')
-rw-r--r--src/elements/pcln.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/elements/pcln.c b/src/elements/pcln.c
index 3f785bb..45cfc79 100644
--- a/src/elements/pcln.c
+++ b/src/elements/pcln.c
@@ -26,7 +26,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
parts[i].life = 10;
}
}
- if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM)
+ if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT)))
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)
@@ -41,7 +41,11 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
(r&0xFF)!=PT_NSCN && (r&0xFF)!=PT_PSCN &&
(r&0xFF)!=PT_STKM && (r&0xFF)!=PT_STKM2 &&
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
- parts[i].ctype = r&0xFF;
+ {
+ parts[i].ctype = r&0xFF;
+ if ((r&0xFF)==PT_LIFE)
+ parts[i].tmp = parts[r>>8].ctype;
+ }
}
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].life==10) {
if (parts[i].ctype==PT_PHOT) {//create photons a different way
@@ -55,10 +59,10 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
}
}
}
- else if (ptypes[parts[i].ctype].properties&PROP_LIFE) {//create life a different way
+ else if (parts[i].ctype==PT_LIFE) {//create life a different way
for (rx=-1; rx<2; rx++) {
for (ry=-1; ry<2; ry++) {
- create_part(-1, x+rx, y+ry, parts[i].ctype);
+ create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
}
}
} else {