1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

BattleAI: missing lock

This commit is contained in:
Andrii Danylchenko 2024-09-03 13:02:42 +03:00
parent f9442208da
commit 07ae33b8f4

View File

@ -68,7 +68,12 @@ void RecruitHero::accept(AIGateway * ai)
throw cannotFulfillGoalException("Town " + t->nodeName() + " is occupied. Cannot recruit hero!");
cb->recruitHero(t, heroToHire);
ai->nullkiller->heroManager->update();
{
std::unique_lock lockGuard(ai->nullkiller->aiStateMutex);
ai->nullkiller->heroManager->update();
}
if(t->visitingHero)
ai->moveHeroToTile(t->visitablePos(), t->visitingHero.get());