From 88ec4fa0e7fd97a9add0bdfa701b0bc9669f0713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Thor=C3=A9n?= Date: Fri, 29 Dec 2023 23:12:06 +0100 Subject: [PATCH] Use getTileThreat-helper instead of directly accessing hitMap with tile coordinates --- AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp index 6cda0e7f3..a5e7981b8 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp @@ -265,11 +265,11 @@ uint64_t DangerHitMapAnalyzer::enemyCanKillOurHeroesAlongThePath(const AIPath & { int3 tile = path.targetTile(); int turn = path.turn(); - const auto & fastestDanger = hitMap[tile.x][tile.y][tile.z].fastestDanger; - const auto & maximumDanger = hitMap[tile.x][tile.y][tile.z].maximumDanger; - return (fastestDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, fastestDanger.danger)) - || (maximumDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, maximumDanger.danger)); + auto& info = getTileThreat(tile); + + 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)); } const HitMapNode & DangerHitMapAnalyzer::getObjectThreat(const CGObjectInstance * obj) const