Browse Source

Fix for inconsistency in planned and performed army-merge.

Removed the usage of BonusModifiers because depending on the case the function was sometimes called with and sometimes without an actual hero as first parameter.
This lead to inconsistencies between planned and performed army-merge and got the AI stuck in a loop where it ordered an army-merge over and over that then would not conclude.
The inclusion of bonuses of the hero for determining which army is better on them is unnecessarily convoluted and just causes issues. It took me like 4 hours to figure out why the AI didn't act.
Xilmi 1 year ago
parent
commit
9c52e3a0b2
1 changed files with 0 additions and 10 deletions
  1. 0 10
      AI/Nullkiller/Analyzers/ArmyManager.cpp

+ 0 - 10
AI/Nullkiller/Analyzers/ArmyManager.cpp

@@ -152,16 +152,6 @@ std::vector<SlotInfo> ArmyManager::getBestArmy(const IBonusBearer * armyCarrier,
 	uint64_t armyValue = 0;
 
 	TemporaryArmy newArmyInstance;
-	auto bonusModifiers = armyCarrier->getBonuses(Selector::type()(BonusType::MORALE));
-
-	for(auto bonus : *bonusModifiers)
-	{
-		// army bonuses will change and object bonuses are temporary
-		if(bonus->source != BonusSource::ARMY && bonus->source != BonusSource::OBJECT_INSTANCE && bonus->source != BonusSource::OBJECT_TYPE)
-		{
-			newArmyInstance.addNewBonus(std::make_shared<Bonus>(*bonus));
-		}
-	}
 
 	while(allowedFactions.size() < alignmentMap.size())
 	{