Prop tool - only check GoL rulestings / names for ctype

They are meaningless when applied to any other property, even .type
This commit is contained in:
jacob1 2021-05-19 00:04:16 -04:00
parent e26ec36fe9
commit 14be92c013
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
2 changed files with 29 additions and 17 deletions

View File

@ -108,7 +108,15 @@ void PropertyWindow::SetProperty()
//#C0FFEE
v = value.Substr(1).ToNumber<unsigned int>(Format::Hex());
}
else if (value.length() > 1 && value.BeginsWith("B") && value.Contains("/"))
else
{
// Try to parse as particle name
v = sim->GetParticleType(value.ToUtf8());
// Try to parse special GoL rules
if (v == -1 && properties[property->GetOption().second].Name == "ctype")
{
if (value.length() > 1 && value.BeginsWith("B") && value.Contains("/"))
{
v = ParseGOLString(value);
if (v == -1)
@ -133,6 +141,10 @@ void PropertyWindow::SetProperty()
}
}
}
}
}
// Parse as plain number
if (v == -1)
{
v = value.ToNumber<int>();

View File

@ -5,7 +5,7 @@ std::vector<StructProperty> const &Particle::GetProperties()
{
static std::vector<StructProperty> properties = {
{ "type" , StructProperty::ParticleType, (intptr_t)(offsetof(Particle, type )) },
{ "life" , StructProperty::ParticleType, (intptr_t)(offsetof(Particle, life )) },
{ "life" , StructProperty::Integer , (intptr_t)(offsetof(Particle, life )) },
{ "ctype" , StructProperty::ParticleType, (intptr_t)(offsetof(Particle, ctype )) },
{ "x" , StructProperty::Float , (intptr_t)(offsetof(Particle, x )) },
{ "y" , StructProperty::Float , (intptr_t)(offsetof(Particle, y )) },