mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 05:41:11 +07:00
Fix 1 Spectator N AI games in seemingly endless loop (#6337)
This commit is contained in:
@ -223,7 +223,7 @@ class GameInfo {
|
|||||||
|| turns < simulateMaxTurns && simulateUntilWin
|
|| turns < simulateMaxTurns && simulateUntilWin
|
||||||
// For multiplayer, if there are 3+ players and one is defeated or spectator,
|
// For multiplayer, if there are 3+ players and one is defeated or spectator,
|
||||||
// we'll want to skip over their turn
|
// we'll want to skip over their turn
|
||||||
|| gameParameters.isOnlineMultiplayer && (thisPlayer.isDefeated() || thisPlayer.isSpectator())
|
|| gameParameters.isOnlineMultiplayer && (thisPlayer.isDefeated() || thisPlayer.isSpectator() && thisPlayer.playerId != UncivGame.Current.settings.userId)
|
||||||
) {
|
) {
|
||||||
if (!thisPlayer.isDefeated() || thisPlayer.isBarbarian()) {
|
if (!thisPlayer.isDefeated() || thisPlayer.isBarbarian()) {
|
||||||
NextTurnAutomation.automateCivMoves(thisPlayer)
|
NextTurnAutomation.automateCivMoves(thisPlayer)
|
||||||
|
@ -489,6 +489,7 @@ class CivilizationInfo {
|
|||||||
diplomacy[otherCiv.civName] = DiplomacyManager(this, otherCiv.civName)
|
diplomacy[otherCiv.civName] = DiplomacyManager(this, otherCiv.civName)
|
||||||
.apply { diplomaticStatus = DiplomaticStatus.Peace }
|
.apply { diplomaticStatus = DiplomaticStatus.Peace }
|
||||||
|
|
||||||
|
if (!otherCiv.isSpectator())
|
||||||
otherCiv.popupAlerts.add(PopupAlert(AlertType.FirstContact, civName))
|
otherCiv.popupAlerts.add(PopupAlert(AlertType.FirstContact, civName))
|
||||||
|
|
||||||
if (isCurrentPlayer())
|
if (isCurrentPlayer())
|
||||||
|
@ -60,14 +60,6 @@ class NewGameScreen(
|
|||||||
rightSideButton.enable()
|
rightSideButton.enable()
|
||||||
rightSideButton.setText("Start game!".tr())
|
rightSideButton.setText("Start game!".tr())
|
||||||
rightSideButton.onClick {
|
rightSideButton.onClick {
|
||||||
if (gameSetupInfo.gameParameters.players.none { it.playerType == PlayerType.Human }) {
|
|
||||||
val noHumanPlayersPopup = Popup(this)
|
|
||||||
noHumanPlayersPopup.addGoodSizedLabel("No human players selected!".tr()).row()
|
|
||||||
noHumanPlayersPopup.addCloseButton()
|
|
||||||
noHumanPlayersPopup.open()
|
|
||||||
return@onClick
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameSetupInfo.gameParameters.isOnlineMultiplayer) {
|
if (gameSetupInfo.gameParameters.isOnlineMultiplayer) {
|
||||||
for (player in gameSetupInfo.gameParameters.players.filter { it.playerType == PlayerType.Human }) {
|
for (player in gameSetupInfo.gameParameters.players.filter { it.playerType == PlayerType.Human }) {
|
||||||
try {
|
try {
|
||||||
@ -82,6 +74,19 @@ class NewGameScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gameSetupInfo.gameParameters.players.none {
|
||||||
|
it.playerType == PlayerType.Human &&
|
||||||
|
// do not allow multiplayer with only remote spectator(s) and AI(s) - non-MP that works
|
||||||
|
!(it.chosenCiv == Constants.spectator && gameSetupInfo.gameParameters.isOnlineMultiplayer &&
|
||||||
|
it.playerId != UncivGame.Current.settings.userId)
|
||||||
|
}) {
|
||||||
|
val noHumanPlayersPopup = Popup(this)
|
||||||
|
noHumanPlayersPopup.addGoodSizedLabel("No human players selected!".tr()).row()
|
||||||
|
noHumanPlayersPopup.addCloseButton()
|
||||||
|
noHumanPlayersPopup.open()
|
||||||
|
return@onClick
|
||||||
|
}
|
||||||
|
|
||||||
Gdx.input.inputProcessor = null // remove input processing - nothing will be clicked!
|
Gdx.input.inputProcessor = null // remove input processing - nothing will be clicked!
|
||||||
|
|
||||||
if (mapOptionsTable.mapTypeSelectBox.selected.value == MapType.custom) {
|
if (mapOptionsTable.mapTypeSelectBox.selected.value == MapType.custom) {
|
||||||
|
Reference in New Issue
Block a user