1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-16 10:19:47 +02:00

Fixed AI ignoring garrisioned heroes when it comes to danger-analysis.

AI now considers garrisoned heros a potential threat for their heroes too.
This commit is contained in:
Xilmi 2024-08-11 12:44:07 +02:00
parent 99e4052dc0
commit 730e574bef

View File

@ -89,6 +89,14 @@ void DangerHitMapAnalyzer::updateHitMap()
heroes[hero->tempOwner][hero] = HeroRole::MAIN;
}
if (obj->ID == Obj::TOWN)
{
auto town = dynamic_cast<const CGTownInstance*>(obj);
auto hero = town->garrisonHero;
if(hero)
heroes[hero->tempOwner][hero] = HeroRole::MAIN;
}
}
auto ourTowns = cb->getTownsInfo();