浏览代码

Fix crash

Fixed a crash due to improperly trying to access "cb".
Xilmi 1 年之前
父节点
当前提交
a7b26e237f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      AI/Nullkiller/Engine/PriorityEvaluator.cpp

+ 2 - 2
AI/Nullkiller/Engine/PriorityEvaluator.cpp

@@ -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();
 			}