PropertyConditional fixes:
- Fixed Equals/NotEquals not working at all because they checked for float values when the property is not a float and vice versa. - Bool comparisons work now. - Removed unnecessary property.GetValue calls, no need to get the value twice in the same method.
This commit is contained in:
@@ -206,22 +206,30 @@ namespace Barotrauma
|
||||
switch (Operator)
|
||||
{
|
||||
case OperatorType.Equals:
|
||||
if (floatValue == null)
|
||||
if (type == typeof(bool))
|
||||
{
|
||||
return property.GetValue().Equals(floatValue);
|
||||
return ((bool)propertyValue) == (Value.ToLowerInvariant() == "true");
|
||||
}
|
||||
else if (floatValue == null)
|
||||
{
|
||||
return propertyValue.ToString().Equals(Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return property.GetValue().Equals(Value);
|
||||
return propertyValue.Equals(floatValue);
|
||||
}
|
||||
case OperatorType.NotEquals:
|
||||
if (floatValue == null)
|
||||
if (type == typeof(bool))
|
||||
{
|
||||
return !property.GetValue().Equals(floatValue);
|
||||
return ((bool)propertyValue) != (Value.ToLowerInvariant() == "true");
|
||||
}
|
||||
else if (floatValue == null)
|
||||
{
|
||||
return !propertyValue.ToString().Equals(Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return !property.GetValue().Equals(Value);
|
||||
return !propertyValue.Equals(floatValue);
|
||||
}
|
||||
case OperatorType.GreaterThan:
|
||||
if (floatValue == null)
|
||||
|
||||
Reference in New Issue
Block a user