mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-31 22:05:10 +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();
|
int3 tile = path.targetTile();
|
||||||
int turn = path.turn();
|
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))
|
auto& info = getTileThreat(tile);
|
||||||
|| (maximumDanger.turn <= turn && !isSafeToVisit(path.targetHero, path.heroArmy, maximumDanger.danger));
|
|
||||||
|
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
|
const HitMapNode & DangerHitMapAnalyzer::getObjectThreat(const CGObjectInstance * obj) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user