summaryrefslogtreecommitdiff
path: root/src/elements/clne.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements/clne.c')
-rw-r--r--src/elements/clne.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/elements/clne.c b/src/elements/clne.c
index 850a3ae..41f27e3 100644
--- a/src/elements/clne.c
+++ b/src/elements/clne.c
@@ -1,7 +1,7 @@
#include <element.h>
int update_CLNE(UPDATE_FUNC_ARGS) {
- 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)))
{
int r, rx, ry;
for (rx=-1; rx<2; rx++)
@@ -17,11 +17,16 @@ int update_CLNE(UPDATE_FUNC_ARGS) {
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
(r&0xFF)!=PT_PBCN && (r&0xFF)!=PT_STKM2 &&
(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;
+ }
}
}
else {
- create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ if (parts[i].ctype==PT_LIFE) create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8));
+ else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
return 0;
}