浏览代码

Fix UI lock on ending turn while simturns are active

Ivan Savenko 1 年之前
父节点
当前提交
b453b9d6d0
共有 1 个文件被更改,包括 12 次插入0 次删除
  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)