소스 검색

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