mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
Moving conditional branches around
This commit is contained in:
@@ -122,15 +122,14 @@ void PropertyWindow::SetProperty()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(properties[property->GetOption().second].Type == StructProperty::ParticleType)
|
int type;
|
||||||
{
|
if (properties[property->GetOption().second].Type == StructProperty::ParticleType && (type = sim->GetParticleType(value)) != -1)
|
||||||
int type = sim->GetParticleType(value);
|
|
||||||
if(type != -1)
|
|
||||||
{
|
{
|
||||||
|
v = type;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "Got type from particle name" << std::endl;
|
std::cout << "Got type from particle name" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
v = type;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -138,22 +137,18 @@ void PropertyWindow::SetProperty()
|
|||||||
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
buffer >> v;
|
buffer >> v;
|
||||||
}
|
}
|
||||||
if (property->GetOption().first == "type" && (v < 0 || v >= PT_NUM || !sim->elements[v].Enabled))
|
}
|
||||||
|
|
||||||
|
if (properties[property->GetOption().second].Type == StructProperty::ParticleType && (v < 0 || v >= PT_NUM || !sim->elements[v].Enabled))
|
||||||
{
|
{
|
||||||
new ErrorMessage("Could not set property", "Invalid particle type");
|
new ErrorMessage("Could not set property", "Invalid particle type");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::stringstream buffer(value);
|
|
||||||
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
|
||||||
buffer >> v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "Got int value " << v << std::endl;
|
std::cout << "Got int value " << v << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tool->propValue.Integer = v;
|
tool->propValue.Integer = v;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user