Skip to content

Commit

Permalink
Fix #64 - Targeting all values applied the operation more than it should
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Nov 14, 2016
1 parent 854aacb commit 833e09b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions moduleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,11 @@ public ConfigNode ModifyNode(ConfigNode original, ConfigNode mod)
}
}

int valCount = 0;
for (int i=0; i<newNode.CountValues; i++)
if (newNode.values[i].name == valName)
valCount++;

char op = ' ';
if (match.Groups[5].Success)
op = match.Groups[5].Value[0];
Expand Down Expand Up @@ -1884,7 +1889,7 @@ public ConfigNode ModifyNode(ConfigNode original, ConfigNode mod)
// Format is @key = value or @key *= value or @key += value or @key -= value
// or @key,index = value or @key,index *= value or @key,index += value or @key,index -= value

while (index < newNode.values.Count)
while (index < valCount)
{
varValue = ProcessVariableSearch(modVal.value, newNode);

Expand Down Expand Up @@ -1926,7 +1931,7 @@ public ConfigNode ModifyNode(ConfigNode original, ConfigNode mod)
}
else if (match.Groups[2].Success)
{
while (index < newNode.values.Count)
while (index < valCount)
{
// If there is an index, use it.
ConfigNode.Value v = FindValueIn(newNode, valName, index);
Expand Down

0 comments on commit 833e09b

Please sign in to comment.