Skip to content

Commit

Permalink
Fix nested node constraints only checking the first set
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Apr 24, 2016
1 parent c8ccaa7 commit cc7f0a6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions moduleManager.cs
Expand Up @@ -2772,9 +2772,21 @@ public static bool CheckConstraints(ConfigNode node, string constraints)

// @MODULE[ModuleAlternator] or !MODULE[ModuleAlternator]
bool not = (constraints[0] == '!');
ConfigNode subNode = MMPatchLoader.FindConfigNodeIn(node, type, name);
if (subNode != null)
return not ^ CheckConstraints(subNode, remainingConstraints);

bool any = false;
int index = 0;
ConfigNode last = null;
while (true)
{
ConfigNode subNode = FindConfigNodeIn(node, type, name, index++);
if (subNode == last || subNode == null)
break;
any = any || CheckConstraints(subNode, remainingConstraints);
last = subNode;
}
if (last != null)
return not ^ any;

return not ^ false;

case '#':
Expand Down

0 comments on commit cc7f0a6

Please sign in to comment.