Include elements[].Enabled in check for invalid lava ctype
This commit is contained in:
parent
8d96f3f6b6
commit
79edfe9589
@ -1389,6 +1389,16 @@ std::string GameController::ElementResolve(int type, int ctype)
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GameController::IsValidElement(int type)
|
||||
{
|
||||
if(gameModel && gameModel->GetSimulation())
|
||||
{
|
||||
return (type > 0 && type < PT_NUM && gameModel->GetSimulation()->elements[type].Enabled);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string GameController::WallName(int type)
|
||||
{
|
||||
if(gameModel && gameModel->GetSimulation() && gameModel->GetSimulation()->wtypes && type >= 0 && type < UI_WALLCOUNT)
|
||||
|
@ -137,6 +137,7 @@ public:
|
||||
ui::Point PointTranslate(ui::Point point);
|
||||
ui::Point NormaliseBlockCoord(ui::Point point);
|
||||
std::string ElementResolve(int type, int ctype);
|
||||
bool IsValidElement(int type);
|
||||
std::string WallName(int type);
|
||||
|
||||
void ResetAir();
|
||||
|
@ -2069,7 +2069,7 @@ void GameView::OnDraw()
|
||||
ctype = sample.particle.tmp&0xFF;
|
||||
if(showDebug)
|
||||
{
|
||||
if (sample.particle.type == PT_LAVA && ctype > 0 && ctype < PT_NUM)
|
||||
if (sample.particle.type == PT_LAVA && c->IsValidElement(ctype))
|
||||
sampleInfo << "Molten " << c->ElementResolve(ctype, -1);
|
||||
else if ((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && ctype > 0 && ctype < PT_NUM)
|
||||
sampleInfo << c->ElementResolve(sample.particle.type, -1) << " with " << c->ElementResolve(ctype, (int)sample.particle.pavg[1]);
|
||||
@ -2087,7 +2087,7 @@ void GameView::OnDraw()
|
||||
else
|
||||
{
|
||||
sampleInfo << c->ElementResolve(sample.particle.type, sample.particle.ctype);
|
||||
if(ctype > 0 && ctype < PT_NUM)
|
||||
if (c->IsValidElement(ctype))
|
||||
sampleInfo << " (" << c->ElementResolve(ctype, -1) << ")";
|
||||
else
|
||||
sampleInfo << " ()";
|
||||
|
@ -3811,7 +3811,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
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))
|
||||
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))
|
||||
parts[i].ctype = PT_WATR;
|
||||
|
||||
if (ctemph>elements[t].HighTemperature && elements[t].HighTemperatureTransition>-1)
|
||||
@ -3838,7 +3838,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
#endif
|
||||
else if (t == PT_ICEI || t == PT_SNOW)
|
||||
{
|
||||
if (parts[i].ctype < PT_NUM && parts[i].ctype != t)
|
||||
if (parts[i].ctype > 0 && parts[i].ctype < PT_NUM && parts[i].ctype != t)
|
||||
{
|
||||
if (elements[parts[i].ctype].LowTemperatureTransition==t && pt<=elements[parts[i].ctype].LowTemperature)
|
||||
s = 0;
|
||||
@ -3941,7 +3941,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
}
|
||||
else if (t == PT_LAVA)
|
||||
{
|
||||
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA)
|
||||
if (parts[i].ctype>0 && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA && parts[i].ctype!=PT_LAVA && elements[parts[i].ctype].Enabled)
|
||||
{
|
||||
if (parts[i].ctype==PT_THRM&&pt>=elements[PT_BMTL].HighTemperature)
|
||||
s = 0;
|
||||
|
Reference in New Issue
Block a user