diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 740593fcc..5a92cc49b 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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-1 && elements[t].LowTemperatureTransition=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) diff --git a/src/simulation/elements/FOG.cpp b/src/simulation/elements/FOG.cpp index 21b5307bc..acede2324 100644 --- a/src/simulation/elements/FOG.cpp +++ b/src/simulation/elements/FOG.cpp @@ -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); } diff --git a/src/simulation/elements/GEL.cpp b/src/simulation/elements/GEL.cpp index 462fe8393..8f6a18e30 100644 --- a/src/simulation/elements/GEL.cpp +++ b/src/simulation/elements/GEL.cpp @@ -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; diff --git a/src/simulation/elements/SOAP.cpp b/src/simulation/elements/SOAP.cpp index 2a320f79a..284484dcc 100644 --- a/src/simulation/elements/SOAP.cpp +++ b/src/simulation/elements/SOAP.cpp @@ -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); diff --git a/src/simulation/elements/STKM.cpp b/src/simulation/elements/STKM.cpp index 35e7c99fc..5e4a08c27 100644 --- a/src/simulation/elements/STKM.cpp +++ b/src/simulation/elements/STKM.cpp @@ -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;