mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Merge pull request #527 from nullkiller/ai-recruit-hero-freeze-patch
AI: fix freeze while endlesly trying to recruit hero
This commit is contained in:
commit
cbbb85fa87
@ -823,6 +823,7 @@ void VCAI::makeTurn()
|
|||||||
}
|
}
|
||||||
markHeroAbleToExplore(primaryHero());
|
markHeroAbleToExplore(primaryHero());
|
||||||
visitedHeroes.clear();
|
visitedHeroes.clear();
|
||||||
|
ai->ah->resetPaths();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1007,6 +1008,9 @@ void VCAI::mainLoop()
|
|||||||
for (auto basicGoal : ultimateGoalsFromBasic[goalToRealize])
|
for (auto basicGoal : ultimateGoalsFromBasic[goalToRealize])
|
||||||
goalsToRemove.push_back(basicGoal);
|
goalsToRemove.push_back(basicGoal);
|
||||||
|
|
||||||
|
// sometimes resource manager contains an elementar goal which is not able to execute anymore and just fails each turn.
|
||||||
|
ai->ah->notifyGoalCompleted(goalToRealize);
|
||||||
|
|
||||||
//we failed to realize best goal, but maybe others are still possible?
|
//we failed to realize best goal, but maybe others are still possible?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2056,6 +2060,10 @@ void VCAI::tryRealize(Goals::RecruitHero & g)
|
|||||||
//TODO try to free way to blocked town
|
//TODO try to free way to blocked town
|
||||||
//TODO: adventure map tavern or prison?
|
//TODO: adventure map tavern or prison?
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw cannotFulfillGoalException("No town to recruit hero!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCAI::tryRealize(Goals::VisitTile & g)
|
void VCAI::tryRealize(Goals::VisitTile & g)
|
||||||
|
Loading…
Reference in New Issue
Block a user