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

Fix AI freeze regression

This commit is contained in:
nordsoft 2023-08-24 16:42:47 +04:00
parent 1bad0e96ef
commit 596b98e1c1

View File

@ -1268,16 +1268,14 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
visitObjectOnTile(t, h);
}
if(!transit)
for(auto topQuery = queries->topQuery(h->tempOwner); true; topQuery = queries->topQuery(h->tempOwner))
{
for(auto topQuery = queries->topQuery(h->tempOwner); true; topQuery = queries->topQuery(h->tempOwner))
{
moveQuery = std::dynamic_pointer_cast<CHeroMovementQuery>(topQuery);
if(moveQuery)
queries->popIfTop(moveQuery);
else
break;
}
moveQuery = std::dynamic_pointer_cast<CHeroMovementQuery>(topQuery);
if(moveQuery
&& (!transit || result == TryMoveHero::FAILED || moveQuery->tmh.stopMovement()))
queries->popIfTop(moveQuery);
else
break;
}
logGlobal->trace("Hero %s ends movement", h->getNameTranslated());
return result != TryMoveHero::FAILED;