Ticket #3570: 3570.7.diff
File 3570.7.diff, 3.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/common/network.js
46 46 /** 47 47 * Must be kept in sync with source/network/NetHost.h 48 48 */ 49 function getDisconnectReason(id )49 function getDisconnectReason(id, wasConnected) 50 50 { 51 51 switch (id) 52 52 { 53 case 0: return translateWithContext("network disconnect", "Unknown reason");53 case 0: return wasConnected ? translateWithContext("network disconnect", "Unknown reason") : translate("Unable to join game. This is often caused by UDP port 20595 not being forwarded on the host side or by a firewall or an anti-virus software."); 54 54 case 1: return translate("The host has ended the game"); 55 55 case 2: return translate("Incorrect network protocol version"); 56 56 case 3: return translate("Game is loading, please try later"); … … 70 70 * 71 71 * @param {number} reason 72 72 */ 73 function reportDisconnect(reason )73 function reportDisconnect(reason, wasConnected) 74 74 { 75 75 // Translation: States the reason why the client disconnected from the server. 76 let reasonText = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(reason ) });77 messageBox(400, 200, translate("Lost connection to the server.") + "\n\n" + reasonText, translate("Disconnected"), 2);76 let reasonText = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(reason, wasConnected) }) 77 messageBox(400, 200, (wasConnected ? translate("Lost connection to the server.") : translate("Failed to connect to server")) + "\n\n" + reasonText, translate("Disconnected"), 2); 78 78 } 79 79 80 80 function kickPlayer(username, ban) -
binaries/data/mods/public/gui/gamesetup/gamesetup.js
623 623 } 624 624 625 625 cancelSetup(); 626 reportDisconnect(message.reason );626 reportDisconnect(message.reason, true); 627 627 } 628 628 629 629 /** -
binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js
92 92 { 93 93 case "disconnected": 94 94 cancelSetup(); 95 reportDisconnect(message.reason );95 reportDisconnect(message.reason, false); 96 96 return; 97 97 98 98 default: … … 165 165 166 166 case "disconnected": 167 167 cancelSetup(); 168 reportDisconnect(message.reason );168 reportDisconnect(message.reason, false); 169 169 return; 170 170 171 171 default: -
binaries/data/mods/public/gui/session/messages.js
59 59 var g_StatusMessageTypes = { 60 60 "authenticated": msg => translate("Connection to the server has been authenticated."), 61 61 "connected": msg => translate("Connected to the server."), 62 // Translation: States the reason why the client disconnected from the server. 62 63 "disconnected": msg => translate("Connection to the server has been lost.") + "\n" + 63 // Translation: States the reason why the client disconnected from the server. 64 sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(msg.reason) }), 64 sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(msg.reason, true) }), 65 65 "waiting_for_players": msg => translate("Waiting for other players to connect..."), 66 66 "join_syncing": msg => translate("Synchronising gameplay with other players..."), 67 67 "active": msg => ""