1
0
mirror of https://github.com/vcmi/vcmi.git synced 2026-05-22 09:55:17 +02:00

#4066 - fix exploration

This commit is contained in:
Andrii Danylchenko
2024-06-01 09:08:23 +03:00
parent 9728413742
commit 7bf047ff18
3 changed files with 12 additions and 5 deletions
+9 -2
View File
@@ -28,7 +28,7 @@ void ExploreNeighbourTile::accept(AIGateway * ai)
{
ExplorationHelper h(hero, ai->nullkiller.get(), true);
for(int i = 0; i < tilesToExplore && hero->movementPointsRemaining() > 0; i++)
for(int i = 0; i < tilesToExplore && ai->myCb->getObj(hero->id, false) && hero->movementPointsRemaining() > 0; i++)
{
int3 pos = hero->visitablePos();
float value = 0;
@@ -54,7 +54,14 @@ void ExploreNeighbourTile::accept(AIGateway * ai)
}
});
if(!target.valid() || !ai->moveHeroToTile(target, hero))
if(!target.valid())
{
return;
}
auto danger = ai->nullkiller->pathfinder->getStorage()->evaluateDanger(target, hero, true);
if(danger > 0 || !ai->moveHeroToTile(target, hero))
{
return;
}