1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

NKAI: fix crash for specific map

This commit is contained in:
Andrii Danylchenko 2023-07-31 22:00:22 +03:00
parent ccfc6f5716
commit 4c0aae6fbd

View File

@ -156,11 +156,10 @@ void DangerHitMapAnalyzer::calculateTileOwners()
CRandomGenerator rng; CRandomGenerator rng;
auto visitablePos = town->visitablePos(); auto visitablePos = town->visitablePos();
townHero->pos = visitablePos;
townHero->setOwner(ai->playerID); // lets avoid having multiple colors townHero->setOwner(ai->playerID); // lets avoid having multiple colors
townHero->initHero(rng, static_cast<HeroTypeID>(0)); townHero->initHero(rng, static_cast<HeroTypeID>(0));
townHero->initObj(rng);
townHero->pos = townHero->convertFromVisitablePos(visitablePos); townHero->pos = townHero->convertFromVisitablePos(visitablePos);
townHero->initObj(rng);
heroTownMap[townHero] = town; heroTownMap[townHero] = town;
townHeroes[townHero] = HeroRole::MAIN; townHeroes[townHero] = HeroRole::MAIN;