Permalink
Browse files

jacksonmj: Stop using Element.State 618c4b5

  • Loading branch information...
jacob1 committed Dec 18, 2015
1 parent bfc19d1 commit f1ea32516dddd173fcb6a3bfeabd5ce696cd419d
@@ -3624,16 +3624,16 @@ void Simulation::UpdateParticles(int start, int end)
ctemph = ctempl = pt;
// change boiling point with pressure
if ((elements[t].State==ST_LIQUID && elements[t].HighTemperatureTransition>-1 && elements[t].HighTemperatureTransition<PT_NUM && elements[elements[t].HighTemperatureTransition].State==ST_GAS)
if (((elements[t].Properties&TYPE_LIQUID) && IsValidElement(elements[t].HighTemperatureTransition) && (elements[elements[t].HighTemperatureTransition].Properties&TYPE_GAS))
|| t==PT_LNTG || t==PT_SLTW)
ctemph -= 2.0f*pv[y/CELL][x/CELL];
else if ((elements[t].State==ST_GAS && elements[t].LowTemperatureTransition>-1 && elements[t].LowTemperatureTransition<PT_NUM && elements[elements[t].LowTemperatureTransition].State==ST_LIQUID)
else if (((elements[t].Properties&TYPE_GAS) && IsValidElement(elements[t].LowTemperatureTransition) && (elements[elements[t].LowTemperatureTransition].Properties&TYPE_LIQUID))
|| t==PT_WTRV)
ctempl -= 2.0f*pv[y/CELL][x/CELL];
s = 1;
//A fix for ice with ctype = 0
if ((t==PT_ICEI || t==PT_SNOW) && (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW || !elements[parts[i].ctype].Enabled))
if ((t==PT_ICEI || t==PT_SNOW) && (!parts[i].ctype || !IsValidElement(parts[i].ctype) || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW))
parts[i].ctype = PT_WATR;
if (elements[t].HighTemperatureTransition>-1 && ctemph>=elements[t].HighTemperature)
@@ -3849,7 +3849,7 @@ void Simulation::UpdateParticles(int start, int end)
//and I don't feel like checking each one right now
parts[i].tmp = 0;
}
if (elements[t].State==ST_GAS && elements[parts[i].type].State!=ST_GAS)
if ((elements[t].Properties&TYPE_GAS) && !(elements[parts[i].type].Properties&TYPE_GAS))
pv[y/CELL][x/CELL] += 0.50f;
if (t == PT_NONE)
@@ -57,7 +57,7 @@ int Element_FOG::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
continue;
if (sim->elements[r&0xFF].State==ST_SOLID && !(rand()%10) && parts[i].life==0 && !((r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
if ((sim->elements[r&0xFF].Properties&TYPE_SOLID) && !(rand()%10) && parts[i].life==0 && !((r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
{
sim->part_change_type(i,x,y,PT_RIME);
}
@@ -133,7 +133,7 @@ int Element_GEL::update(UPDATE_FUNC_ARGS)
float per, nd;
nd = dx*dx + dy*dy - 0.5;
per = 5*(1 - parts[i].tmp/100)*(nd/(dx*dx + dy*dy + nd) - 0.5);
if (sim->elements[rt].State==ST_LIQUID)
if (sim->elements[rt].Properties&TYPE_LIQUID)
per *= 0.1;
dx *= per; dy *= per;
parts[i].vx += dx;
@@ -165,7 +165,7 @@ int Element_SOAP::update(UPDATE_FUNC_ARGS)
if (parts[i].temp>FREEZING)
{
if (sim->bmap[(y+ry)/CELL][(x+rx)/CELL]
|| (r && sim->elements[r&0xFF].State != ST_GAS
|| (r && !(sim->elements[r&0xFF].Properties&TYPE_GAS)
&& (r&0xFF) != PT_SOAP && (r&0xFF) != PT_GLAS))
{
detach(sim, i);
@@ -366,7 +366,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
if (!r && !sim->bmap[(y+ry)/CELL][(x+rx)/CELL])
continue;
if (sim->elements[r&0xFF].Falldown!=0 || sim->elements[r&0xFF].State == ST_GAS
if (sim->elements[r&0xFF].Falldown != 0
|| sim->elements[r&0xFF].Properties&TYPE_GAS
|| sim->elements[r&0xFF].Properties&TYPE_LIQUID
|| (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT)
@@ -412,7 +412,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
{
ry -= 2*(rand()%2)+1;
r = pmap[ry][rx];
if (sim->elements[r&0xFF].State == ST_SOLID)
if (sim->elements[r&0xFF].Properties&TYPE_SOLID)
{
sim->create_part(-1, rx, ry, PT_SPRK);
playerp->frames = 0;

0 comments on commit f1ea325

Please sign in to comment.