Don't ask the host to exit the game upon defeat if other humans are still playing.

Remove the now unneeded disconnect warning (which is still present for
the menu exit button).

This was SVN commit r19010.
This commit is contained in:
elexis 2016-11-28 14:19:17 +00:00
parent d296cbab7c
commit 041c456999

View File

@ -720,11 +720,16 @@ function confirmExit()
closeOpenDialogs();
let subject = g_PlayerStateMessages[g_ConfirmExit] + "\n" +
translate("Do you want to quit?");
// Don't ask for exit if other humans are still playing
let isHost = g_IsController && g_IsNetworked;
let askExit = !isHost || isHost && g_Players.every((player, i) =>
i == 0 ||
player.state != "active" ||
g_GameAttributes.settings.PlayerData[i].AI != "");
if (g_IsNetworked && g_IsController)
subject += "\n" + translate("Leaving will disconnect all other players.");
let subject = g_PlayerStateMessages[g_ConfirmExit];
if (askExit)
subject += "\n" + translate("Do you want to quit?")
messageBox(
400, 200,
@ -732,8 +737,8 @@ function confirmExit()
g_ConfirmExit == "won" ?
translate("VICTORIOUS!") :
translate("DEFEATED!"),
[translate("No"), translate("Yes")],
[resumeGame, leaveGame]
askExit ? [translate("No"), translate("Yes")] : [translate("Ok")],
askExit ? [resumeGame, leaveGame] : [resumeGame]
);
g_ConfirmExit = false;