diff options
Diffstat (limited to 'src/elements/bcln.c')
| -rw-r--r-- | src/elements/bcln.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/elements/bcln.c b/src/elements/bcln.c index 6ecacac..062c85f 100644 --- a/src/elements/bcln.c +++ b/src/elements/bcln.c @@ -9,7 +9,7 @@ int update_BCLN(UPDATE_FUNC_ARGS) { parts[i].vx += advection*vx[y/CELL][x/CELL]; parts[i].vy += advection*vy[y/CELL][x/CELL]; } - 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++) @@ -25,11 +25,16 @@ int update_BCLN(UPDATE_FUNC_ARGS) { (r&0xFF)!=PT_BCLN && (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; + } } } 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; } |
