mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
NKAI: a few crash/hang fixes
This commit is contained in:
parent
ae1d2c50e2
commit
233b850daf
@ -774,8 +774,10 @@ void AIGateway::makeTurn()
|
|||||||
retrieveVisitableObjs();
|
retrieveVisitableObjs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if NKAI_TRACE_LEVEL == 0
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
nullkiller->makeTurn();
|
nullkiller->makeTurn();
|
||||||
|
|
||||||
//for debug purpose
|
//for debug purpose
|
||||||
@ -784,6 +786,7 @@ void AIGateway::makeTurn()
|
|||||||
if (h->movement)
|
if (h->movement)
|
||||||
logAi->warn("Hero %s has %d MP left", h->name, h->movement);
|
logAi->warn("Hero %s has %d MP left", h->name, h->movement);
|
||||||
}
|
}
|
||||||
|
#if NKAI_TRACE_LEVEL == 0
|
||||||
}
|
}
|
||||||
catch (boost::thread_interrupted & e)
|
catch (boost::thread_interrupted & e)
|
||||||
{
|
{
|
||||||
@ -795,6 +798,7 @@ void AIGateway::makeTurn()
|
|||||||
{
|
{
|
||||||
logAi->debug("Making turn thread has caught an exception: %s", e.what());
|
logAi->debug("Making turn thread has caught an exception: %s", e.what());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
endTurn();
|
endTurn();
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ void Nullkiller::executeTask(Goals::TTask task)
|
|||||||
{
|
{
|
||||||
logAi->trace("Task %s completed", task->toString());
|
logAi->trace("Task %s completed", task->toString());
|
||||||
}
|
}
|
||||||
catch(std::exception & e)
|
catch(cannotFulfillGoalException & e)
|
||||||
{
|
{
|
||||||
logAi->debug("Failed to realize subgoal of type %s, I will stop.", taskDescr);
|
logAi->debug("Failed to realize subgoal of type %s, I will stop.", taskDescr);
|
||||||
logAi->debug("The error message was: %s", e.what());
|
logAi->debug("The error message was: %s", e.what());
|
||||||
|
@ -1086,7 +1086,7 @@ void AINodeStorage::calculateTownPortal(
|
|||||||
for(const CGTownInstance * targetTown : towns)
|
for(const CGTownInstance * targetTown : towns)
|
||||||
{
|
{
|
||||||
// TODO: allow to hide visiting hero in garrison
|
// TODO: allow to hide visiting hero in garrison
|
||||||
if(targetTown->visitingHero)
|
if(targetTown->visitingHero && maskMap.find(targetTown->visitingHero.get()) != maskMap.end())
|
||||||
{
|
{
|
||||||
auto basicMask = maskMap.at(targetTown->visitingHero.get());
|
auto basicMask = maskMap.at(targetTown->visitingHero.get());
|
||||||
bool heroIsInChain = (actor->chainMask & basicMask) != 0;
|
bool heroIsInChain = (actor->chainMask & basicMask) != 0;
|
||||||
|
@ -339,7 +339,7 @@ void CPathfinder::calculatePaths()
|
|||||||
auto hlp = config->getOrCreatePathfinderHelper(source, gs);
|
auto hlp = config->getOrCreatePathfinderHelper(source, gs);
|
||||||
|
|
||||||
if(hlp->isHeroPatrolLocked())
|
if(hlp->isHeroPatrolLocked())
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
pq.push(initialNode);
|
pq.push(initialNode);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user