1
1
forked from 0ad/0ad

Show a more specific disconnect-message in case the host closed the server. Refs #3264, #3570.

This was SVN commit r17710.
This commit is contained in:
elexis 2016-01-25 12:56:30 +00:00
parent 3ec3f0b160
commit ab16ddb256
5 changed files with 8 additions and 9 deletions

View File

@ -13,7 +13,7 @@ function getDisconnectReason(id)
switch (id)
{
case 0: return translate("Unknown reason");
case 1: return translate("Unexpected shutdown");
case 1: return translate("The host has ended the game");
case 2: return translate("Incorrect network protocol version");
case 3: return translate("Game is loading, please try later");
case 4: return translate("Game has already started, no observers allowed");

View File

@ -60,8 +60,7 @@ var g_StatusMessageTypes = {
"connected": msg => translate("Connected to the server."),
"disconnected": msg => translate("Connection to the server has been lost.") + "\n" +
// Translation: States the reason why the client disconnected from the server.
sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(msg.reason) }) + "\n" +
translate("The game has ended."),
sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(msg.reason) }),
"waiting_for_players": msg => translate("Waiting for other players to connect..."),
"join_syncing": msg => translate("Synchronising gameplay with other players..."),
"active": msg => ""

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -60,7 +60,7 @@ typedef std::map<CStr, PlayerAssignment> PlayerAssignmentMap; // map from GUID -
enum NetDisconnectReason
{
NDR_UNKNOWN = 0,
NDR_UNEXPECTED_SHUTDOWN,
NDR_SERVER_SHUTDOWN,
NDR_INCORRECT_PROTOCOL_VERSION,
NDR_SERVER_LOADING,
NDR_SERVER_ALREADY_IN_GAME,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -151,7 +151,7 @@ CNetServerWorker::~CNetServerWorker()
for (size_t i = 0; i < m_Sessions.size(); ++i)
{
m_Sessions[i]->DisconnectNow(NDR_UNEXPECTED_SHUTDOWN);
m_Sessions[i]->DisconnectNow(NDR_SERVER_SHUTDOWN);
delete m_Sessions[i];
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -39,7 +39,7 @@ CNetClientSession::~CNetClientSession()
if (m_Host && m_Server)
{
// Disconnect immediately (we can't wait for acks)
enet_peer_disconnect_now(m_Server, NDR_UNEXPECTED_SHUTDOWN);
enet_peer_disconnect_now(m_Server, NDR_SERVER_SHUTDOWN);
enet_host_destroy(m_Host);
m_Host = NULL;