1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-03 14:52:11 +02:00

Fix crash

Fixed a crash due to improperly trying to access "cb".
This commit is contained in:
Xilmi 2024-08-11 21:59:06 +02:00
parent fba34a743e
commit a7b26e237f

View File

@ -1210,7 +1210,7 @@ public:
evaluationContext.armyReward += potentialUpgradeValue / (float)bi.prerequisitesCount;
}
int sameTownBonus = 0;
for (auto town : cb->getTownsInfo())
for (auto town : evaluationContext.evaluator.ai->cb->getTownsInfo())
{
if (buildThis.town->getFaction() == town->getFaction())
sameTownBonus+=town->getTownLevel();
@ -1225,7 +1225,7 @@ public:
else if(bi.id >= BuildingID::MAGES_GUILD_1 && bi.id <= BuildingID::MAGES_GUILD_5)
{
evaluationContext.skillReward += 2 * (bi.id - BuildingID::MAGES_GUILD_1);
for (auto hero : cb->getHeroesInfo())
for (auto hero : evaluationContext.evaluator.ai->cb->getHeroesInfo())
{
evaluationContext.armyInvolvement += hero->getArmyCost();
}