Browse Source

Fix for double army-loss

Fixed that army loss was taken into account both for the path and the target-object. In certain cases, like a hero defending a town, this could lead to armyloss being twice as high as it should be.
Xilmi 1 năm trước cách đây
mục cha
commit
83ffbdff2b
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      AI/Nullkiller/Pathfinding/AINodeStorage.cpp

+ 2 - 2
AI/Nullkiller/Pathfinding/AINodeStorage.cpp

@@ -1509,7 +1509,7 @@ uint8_t AIPath::turn() const
 
 uint64_t AIPath::getHeroStrength() const
 {
-	return targetHero->getFightingStrength() * getHeroArmyStrengthWithCommander(targetHero, heroArmy);
+	return targetHero->getHeroStrength() * getHeroArmyStrengthWithCommander(targetHero, heroArmy);
 }
 
 uint64_t AIPath::getTotalDanger() const
@@ -1536,7 +1536,7 @@ bool AIPath::containsHero(const CGHeroInstance * hero) const
 
 uint64_t AIPath::getTotalArmyLoss() const
 {
-	return armyLoss + targetObjectArmyLoss;
+	return armyLoss > targetObjectArmyLoss ? armyLoss : targetObjectArmyLoss;
 }
 
 std::string AIPath::toString() const