Add Switch On Enum node
This commit is contained in:
@@ -860,6 +860,28 @@ void VisjectExecutor::ProcessGroupComparisons(Box* box, Node* node, Value& value
|
||||
else
|
||||
value = tryGetValue(node->GetBox(1), 0, Value::Zero);
|
||||
break;
|
||||
}
|
||||
// Switch On Enum
|
||||
case 8:
|
||||
{
|
||||
const Value v = tryGetValue(node->GetBox(0), Value::Null);
|
||||
if (v.Type.Type == VariantType::Enum && node->Values.Count() == 1 && node->Values[0].Type.Type == VariantType::Blob)
|
||||
{
|
||||
int32* dataValues = (int32*)node->Values[0].AsBlob.Data;
|
||||
int32 dataValuesCount = node->Values[0].AsBlob.Length / 4;
|
||||
int32 vAsInt = (int32)v;
|
||||
for (int32 i = 0; i < dataValuesCount; i++)
|
||||
{
|
||||
if (dataValues[i] == vAsInt)
|
||||
{
|
||||
value = tryGetValue(node->GetBox(i + 2), Value::Null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
value = Value::Null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user