mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Use getTileThreat-helper instead of directly accessing hitMap with tile coordinates
This commit is contained in:
parent
61314a36f6
commit
88ec4fa0e7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user