diff options
| author | Simon 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) |
| commit | 0cb47ab93cb7474f24c867ec0b9b9c9ac2dbf487 (patch) | |
| tree | 316f4236cae91cbaf469c5a295e060ab5f1ce84d /src/simulation | |
| parent | f0778c20332cc837a0d05996292a6e5e6265a9d7 (diff) | |
| download | powder-0cb47ab93cb7474f24c867ec0b9b9c9ac2dbf487.zip powder-0cb47ab93cb7474f24c867ec0b9b9c9ac2dbf487.tar.gz | |
TPT: Remember ctype when cloning lava
Diffstat (limited to 'src/simulation')
| -rw-r--r-- | src/simulation/elements/BCLN.cpp | 16 | ||||
| -rw-r--r-- | src/simulation/elements/CLNE.cpp | 14 | ||||
| -rw-r--r-- | src/simulation/elements/PBCN.cpp | 15 | ||||
| -rw-r--r-- | src/simulation/elements/PCLN.cpp | 15 |
4 files changed, 45 insertions, 15 deletions
diff --git a/src/simulation/elements/BCLN.cpp b/src/simulation/elements/BCLN.cpp index 3db0654..281ecb2 100644 --- a/src/simulation/elements/BCLN.cpp +++ b/src/simulation/elements/BCLN.cpp @@ -71,21 +71,29 @@ int Element_BCLN::update(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) sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, 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; } -Element_BCLN::~Element_BCLN() {}
\ No newline at end of file +Element_BCLN::~Element_BCLN() {} diff --git a/src/simulation/elements/CLNE.cpp b/src/simulation/elements/CLNE.cpp index 56839f0..939feb0 100644 --- a/src/simulation/elements/CLNE.cpp +++ b/src/simulation/elements/CLNE.cpp @@ -67,17 +67,25 @@ int Element_CLNE::update(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) sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, 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; } -Element_CLNE::~Element_CLNE() {}
\ No newline at end of file +Element_CLNE::~Element_CLNE() {} diff --git a/src/simulation/elements/PBCN.cpp b/src/simulation/elements/PBCN.cpp index 270bfb5..af37a59 100644 --- a/src/simulation/elements/PBCN.cpp +++ b/src/simulation/elements/PBCN.cpp @@ -82,7 +82,7 @@ int Element_PBCN::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; } } @@ -135,8 +135,15 @@ int Element_PBCN::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; @@ -154,4 +161,4 @@ int Element_PBCN::graphics(GRAPHICS_FUNC_ARGS) } -Element_PBCN::~Element_PBCN() {}
\ No newline at end of file +Element_PBCN::~Element_PBCN() {} 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() {} |
