1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix UI lock on ending turn while simturns are active

This commit is contained in:
Ivan Savenko 2024-01-13 23:38:43 +02:00
parent 45a3d04d25
commit b453b9d6d0

View File

@ -467,6 +467,18 @@ void AdventureMapInterface::hotkeyEndingTurn()
LOCPLINT->cb->endTurn();
mapAudio->onPlayerTurnEnded();
// Normally, game will receive PlayerStartsTurn call almost instantly with new player ID that will switch UI to waiting mode
// However, when simturns are active it is possible for such call not to come because another player is still acting
// So find first player other than ours that is acting at the moment and update UI as if he had started turn
for (auto player = PlayerColor(0); player < PlayerColor::PLAYER_LIMIT; ++player)
{
if (player != LOCPLINT->playerID && LOCPLINT->cb->isPlayerMakingTurn(player))
{
onEnemyTurnStarted(player, LOCPLINT->cb->getStartInfo()->playerInfos.at(player).isControlledByHuman());
break;
}
}
}
const CGObjectInstance* AdventureMapInterface::getActiveObject(const int3 &mapPos)