Skip to content

Commit

Permalink
< and > for value HAS check ( #mass[<100] ~mass[>100] )
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Mar 24, 2015
1 parent 00eddc5 commit 5dd543c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion moduleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2057,11 +2057,26 @@ public static bool CheckConstraints(ConfigNode node, string constraints)

public static bool WildcardMatchValues(ConfigNode node, string type, string value)
{
double val;
bool compare = value.Length > 1 && (value[0] == '<' || value[0] == '>');
compare = compare && Double.TryParse(value.Substring(1), out val);


string[] values = node.GetValues(type);
for (int i = 0; i < values.Length; i++)
{
if (WildcardMatch(values[i], value))
if (!compare && WildcardMatch(values[i], value))
return true;

double val2;
if (compare && Double.TryParse(values[i], out val2)
&& ((value[0] == '<' && val2 < val) || (value[0] == '>' && val2 > val))
)
{
return true;

}

}
return false;
}
Expand Down

0 comments on commit 5dd543c

Please sign in to comment.