From 5ed888b284ec9a19ae773056c5939e8ccac47a09 Mon Sep 17 00:00:00 2001 From: Xilmi Date: Thu, 12 Sep 2024 20:07:22 +0200 Subject: [PATCH] Update BuyArmyBehavior.cpp Accomplish the same but with simpler code. --- AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp index 99c362bac..738196e2d 100644 --- a/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp @@ -39,11 +39,7 @@ Goals::TGoalVec BuyArmyBehavior::decompose(const Nullkiller * ai) const for(auto town : cb->getTownsInfo()) { - uint8_t closestThreat = UINT8_MAX; - for (auto threat : ai->dangerHitMap->getTownThreats(town)) - { - closestThreat = std::min(closestThreat, threat.turn); - } + uint8_t closestThreat = ai->dangerHitMap->getTileThreat(town->visitablePos()).fastestDanger.turn; if (closestThreat >=2 && ai->buildAnalyzer->isGoldPressureHigh() && !town->hasBuilt(BuildingID::CITY_HALL) && cb->canBuildStructure(town, BuildingID::CITY_HALL) != EBuildingState::FORBIDDEN) {