diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp index 1ee4e57f5..472719004 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp @@ -265,10 +265,11 @@ uint64_t DangerHitMapAnalyzer::enemyCanKillOurHeroesAlongThePath(const AIPath & { int3 tile = path.targetTile(); int turn = path.turn(); - const HitMapNode & info = hitMap[tile.x][tile.y][tile.z]; + const auto & fastestDanger = hitMap[tile.x][tile.y][tile.z].fastestDanger; + const auto & maximumDanger = hitMap[tile.x][tile.y][tile.z].fastestDanger; - return (info.fastestDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, info.fastestDanger.danger)) - || (info.maximumDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, info.maximumDanger.danger)); + return (fastestDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, fastestDanger.danger)) + || (maximumDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, maximumDanger.danger)); } const HitMapNode & DangerHitMapAnalyzer::getObjectThreat(const CGObjectInstance * obj) const @@ -280,9 +281,7 @@ const HitMapNode & DangerHitMapAnalyzer::getObjectThreat(const CGObjectInstance const HitMapNode & DangerHitMapAnalyzer::getTileThreat(const int3 & tile) const { - const HitMapNode & info = hitMap[tile.x][tile.y][tile.z]; - - return info; + return hitMap[tile.x][tile.y][tile.z]; } const std::set empty = {}; diff --git a/AI/VCAI/Pathfinding/AINodeStorage.cpp b/AI/VCAI/Pathfinding/AINodeStorage.cpp index 8e7bc4a8b..f0bb91c9c 100644 --- a/AI/VCAI/Pathfinding/AINodeStorage.cpp +++ b/AI/VCAI/Pathfinding/AINodeStorage.cpp @@ -321,9 +321,7 @@ bool AINodeStorage::hasBetterChain(const PathNodeInfo & source, CDestinationNode bool AINodeStorage::isTileAccessible(const int3 & pos, const EPathfindingLayer layer) const { - const AIPathNode & node = nodes[layer][pos.z][pos.x][pos.y][0]; - - return node.action != EPathNodeAction::UNKNOWN; + return nodes[layer][pos.z][pos.x][pos.y][0].action != EPathNodeAction::UNKNOWN; } std::vector AINodeStorage::getChainInfo(const int3 & pos, bool isOnLand) const