1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-29 21:56:54 +02:00

Try more robust approach for waiting dialogs in battles in MP

This commit is contained in:
Ivan Savenko 2024-08-19 18:20:11 +00:00
parent fec3d070b5
commit 6a6c13471c

View File

@ -620,9 +620,7 @@ void CPlayerInterface::battleStartBefore(const BattleID & battleID, const CCreat
{
movementController->onBattleStarted();
//Don't wait for dialogs when we are non-active hot-seat player
if (makingTurn)
waitForAllDialogs();
waitForAllDialogs();
}
void CPlayerInterface::battleStart(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side, bool replayAllowed)
@ -645,9 +643,7 @@ void CPlayerInterface::battleStart(const BattleID & battleID, const CCreatureSet
cb->registerBattleInterface(autofightingAI);
}
//Don't wait for dialogs when we are non-active hot-seat player
if (LOCPLINT == this)
waitForAllDialogs();
waitForAllDialogs();
BATTLE_EVENT_POSSIBLE_RETURN;
}
@ -1830,6 +1826,9 @@ void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
void CPlayerInterface::waitForAllDialogs()
{
if (!makingTurn)
return;
while(!dialogs.empty())
{
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);