Bladeren bron

Fix bonus tree on node move

AlexVinS 9 jaren geleden
bovenliggende
commit
69395d4c78
1 gewijzigde bestanden met toevoegingen van 14 en 0 verwijderingen
  1. 14 0
      lib/HeroBonus.cpp

+ 14 - 0
lib/HeroBonus.cpp

@@ -721,6 +721,20 @@ CBonusSystemNode::CBonusSystemNode(CBonusSystemNode && other):
 	std::swap(parents, other.parents);
 	std::swap(children, other.children);
 
+	//fixing bonus tree without recalculation
+
+	for(CBonusSystemNode * n : parents)
+	{
+		n->children -= &other;
+		n->children.push_back(this);
+	}
+
+	for(CBonusSystemNode * n : children)
+	{
+		n->parents -= &other;
+		n->parents.push_back(this);
+	}
+
 	//cache ignored
 
 	//cachedBonuses