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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user