diff --git a/AI/BattleAI/BattleEvaluator.cpp b/AI/BattleAI/BattleEvaluator.cpp index 9ebd75a7a..ba3df7786 100644 --- a/AI/BattleAI/BattleEvaluator.cpp +++ b/AI/BattleAI/BattleEvaluator.cpp @@ -265,7 +265,7 @@ BattleAction BattleEvaluator::goTowardsNearest(const CStack * stack, std::vector { std::sort(targetHexes.begin(), targetHexes.end(), [&](BattleHex h1, BattleHex h2) -> bool { - return reachability.distances[h1] < reachability.distances[h2]; + return reachability.distances.at(h1) < reachability.distances.at(h2); }); for(auto hex : targetHexes) @@ -283,7 +283,7 @@ BattleAction BattleEvaluator::goTowardsNearest(const CStack * stack, std::vector } } - if(reachability.distances[targetHexes.front()] <= GameConstants::BFIELD_SIZE) + if(reachability.distances.at(targetHexes.front()) <= GameConstants::BFIELD_SIZE) { break; } @@ -299,7 +299,7 @@ BattleAction BattleEvaluator::goTowardsNearest(const CStack * stack, std::vector BattleHex bestNeighbor = targetHexes.front(); - if(reachability.distances[bestNeighbor] > GameConstants::BFIELD_SIZE) + if(reachability.distances.at(bestNeighbor) > GameConstants::BFIELD_SIZE) { return BattleAction::makeDefend(stack); } diff --git a/AI/BattleAI/BattleExchangeVariant.cpp b/AI/BattleAI/BattleExchangeVariant.cpp index 1f83b58e8..3bbd25302 100644 --- a/AI/BattleAI/BattleExchangeVariant.cpp +++ b/AI/BattleAI/BattleExchangeVariant.cpp @@ -764,7 +764,7 @@ std::vector BattleExchangeEvaluator::getOneTurnReachableUn ReachabilityInfo unitReachability = reachabilityIter != reachabilityCache.end() ? reachabilityIter->second : turnBattle.getReachability(unit); - bool reachable = unitReachability.distances[hex] <= radius; + bool reachable = unitReachability.distances.at(hex) <= radius; if(!reachable && unitReachability.accessibility[hex] == EAccessibility::ALIVE_STACK) { @@ -774,7 +774,7 @@ std::vector BattleExchangeEvaluator::getOneTurnReachableUn { for(BattleHex neighbor : hex.neighbouringTiles()) { - reachable = unitReachability.distances[neighbor] <= radius; + reachable = unitReachability.distances.at(neighbor) <= radius; if(reachable) break; } @@ -824,7 +824,7 @@ bool BattleExchangeEvaluator::checkPositionBlocksOurStacks(HypotheticBattle & hb for(BattleHex hex = BattleHex::TOP_LEFT; hex.isValid(); hex = hex + 1) { bool enemyUnit = false; - bool reachable = unitReachability.distances[hex] <= unitSpeed; + bool reachable = unitReachability.distances.at(hex) <= unitSpeed; if(!reachable && unitReachability.accessibility[hex] == EAccessibility::ALIVE_STACK) { @@ -836,7 +836,7 @@ bool BattleExchangeEvaluator::checkPositionBlocksOurStacks(HypotheticBattle & hb for(BattleHex neighbor : hex.neighbouringTiles()) { - reachable = unitReachability.distances[neighbor] <= unitSpeed; + reachable = unitReachability.distances.at(neighbor) <= unitSpeed; if(reachable) break; } diff --git a/lib/battle/CBattleInfoCallback.cpp b/lib/battle/CBattleInfoCallback.cpp index 914c20e0e..6dce09469 100644 --- a/lib/battle/CBattleInfoCallback.cpp +++ b/lib/battle/CBattleInfoCallback.cpp @@ -1035,7 +1035,7 @@ ReachabilityInfo CBattleInfoCallback::makeBFS(const AccessibilityInfo &accessibi if(isInObstacle(curHex, obstacles, checkParams)) continue; - const int costToNeighbour = ret.distances[curHex.hex] + 1; + const int costToNeighbour = ret.distances.at(curHex.hex) + 1; for(BattleHex neighbour : BattleHex::neighbouringTilesCache[curHex.hex]) { if(neighbour.isValid())