浏览代码

Fix bonus tree on node move

AlexVinS 9 年之前
父节点
当前提交
69395d4c78
共有 1 个文件被更改,包括 14 次插入0 次删除
  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