Browse Source

Fix UI lock on ending turn while simturns are active

Ivan Savenko 1 year ago
parent
commit
b453b9d6d0
1 changed files with 12 additions and 0 deletions
  1. 12 0
      client/adventureMap/AdventureMapInterface.cpp

+ 12 - 0
client/adventureMap/AdventureMapInterface.cpp

@@ -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)