diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-06-10 21:53:40 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-06-10 21:57:26 (GMT) |
| commit | 77079439819dca2da9a3dda9120ea304e5e2d4fb (patch) | |
| tree | 4e46697d5cac79daaf952e47014f8e06744eefb1 /src/elements | |
| parent | 3c14787064cba769be045a56de5406fa791ad541 (diff) | |
| download | powder-77079439819dca2da9a3dda9120ea304e5e2d4fb.zip powder-77079439819dca2da9a3dda9120ea304e5e2d4fb.tar.gz | |
Remember ctype when cloning lava
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/bcln.c | 14 | ||||
| -rw-r--r-- | src/elements/clne.c | 12 | ||||
| -rw-r--r-- | src/elements/pbcn.c | 13 | ||||
| -rw-r--r-- | src/elements/pcln.c | 13 |
4 files changed, 41 insertions, 11 deletions
diff --git a/src/elements/bcln.c b/src/elements/bcln.c index 328fc6e..91dac12 100644 --- a/src/elements/bcln.c +++ b/src/elements/bcln.c @@ -38,18 +38,26 @@ int update_BCLN(UPDATE_FUNC_ARGS) { continue; if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM && - (r&0xFF)!=PT_STKM2 && (r&0xFF)!=PT_PBCN && + (r&0xFF)!=PT_PBCN && (r&0xFF)!=PT_STKM2 && (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; } } } else { 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); + else + { + int np = 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 && ptransitions[parts[i].tmp].tht==PT_LAVA) + parts[np].ctype = parts[i].tmp; + } + } } return 0; } diff --git a/src/elements/clne.c b/src/elements/clne.c index 3dfd7bb..3ac45d8 100644 --- a/src/elements/clne.c +++ b/src/elements/clne.c @@ -34,14 +34,22 @@ int update_CLNE(UPDATE_FUNC_ARGS) { (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; } } } else { 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); + else + { + int np = 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 && ptransitions[parts[i].tmp].tht==PT_LAVA) + parts[np].ctype = parts[i].tmp; + } + } } return 0; } diff --git a/src/elements/pbcn.c b/src/elements/pbcn.c index df38248..001c5df 100644 --- a/src/elements/pbcn.c +++ b/src/elements/pbcn.c @@ -49,7 +49,7 @@ int update_PBCN(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; } } @@ -100,8 +100,15 @@ int update_PBCN(UPDATE_FUNC_ARGS) { create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8)); } } - } else { - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + } + else + { + int np = 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 && ptransitions[parts[i].tmp].tht==PT_LAVA) + parts[np].ctype = parts[i].tmp; + } } } return 0; diff --git a/src/elements/pcln.c b/src/elements/pcln.c index ac286aa..1ffcbb4 100644 --- a/src/elements/pcln.c +++ b/src/elements/pcln.c @@ -58,7 +58,7 @@ int update_PCLN(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; } } @@ -90,8 +90,15 @@ int update_PCLN(UPDATE_FUNC_ARGS) { create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8)); } } - } else { - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + } + else + { + int np = 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 && ptransitions[parts[i].tmp].tht==PT_LAVA) + parts[np].ctype = parts[i].tmp; + } } } return 0; |
