TPT: Remember ctype when cloning lava

This commit is contained in:
Simon Robertshaw 2012-06-13 01:37:32 +01:00
parent f0778c2033
commit 0cb47ab93c
4 changed files with 45 additions and 15 deletions

View File

@ -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() {}
Element_BCLN::~Element_BCLN() {}

View File

@ -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() {}
Element_CLNE::~Element_CLNE() {}

View File

@ -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() {}
Element_PBCN::~Element_PBCN() {}

View File

@ -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() {}
Element_PCLN::~Element_PCLN() {}