Skip to content

Commit

Permalink
Leave out children already shown in ancestor node
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jan 17, 2018
1 parent 26ff29b commit ee6d4cd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions GUI/MainModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@ private void BeforeExpand(object sender, TreeViewCancelEventArgs args)
Cursor.Current = prevCur;
}

private bool ImMyOwnGrandpa(TreeNode node)
{
CkanModule module = node.Tag as CkanModule;
if (module != null)
{
for (TreeNode other = node.Parent; other != null; other = other.Parent)
{
if (module == other.Tag)
{
return true;
}
}
}
return false;
}

private void UpdateModDependencyGraph(CkanModule module)
{
ModInfoTabControl.Tag = module ?? ModInfoTabControl.Tag;
Expand Down Expand Up @@ -224,6 +240,10 @@ private void _UpdateModDependencyGraph()

private void AddChildren(IRegistryQuerier registry, TreeNode node)
{
// Skip children of nodes from circular dependencies
if (ImMyOwnGrandpa(node))
return;

// Load one layer of grandchildren on demand
CkanModule module = node.Tag as CkanModule;
// Tag is null for non-indexed nodes
Expand Down

0 comments on commit ee6d4cd

Please sign in to comment.