1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-22 03:39:45 +02:00

Update BuyArmyBehavior.cpp

Accomplish the same but with simpler code.
This commit is contained in:
Xilmi 2024-09-12 20:07:22 +02:00
parent a1a03d4b74
commit 5ed888b284

@ -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)
{