1 | Index: binaries/data/mods/public/gui/common/network.js
|
---|
2 | ===================================================================
|
---|
3 | --- binaries/data/mods/public/gui/common/network.js (revision 17233)
|
---|
4 | +++ binaries/data/mods/public/gui/common/network.js (working copy)
|
---|
5 | @@ -4,12 +4,16 @@
|
---|
6 | * @param reason {number}
|
---|
7 | * @returns {string}
|
---|
8 | */
|
---|
9 | -function getDisconnectReason(id)
|
---|
10 | +function getDisconnectReason(id, wasConnected)
|
---|
11 | {
|
---|
12 | // Must be kept in sync with source/network/NetHost.h
|
---|
13 | switch (id)
|
---|
14 | {
|
---|
15 | - case 0: return translate("Unknown reason");
|
---|
16 | + case 0:
|
---|
17 | + return wasConnected ? translate("Unknown reason.") : translate("This is generally due to port 20595 not being forwarded on the host side. Also, check if you have any firewall or anti-virus blocking the connection.");
|
---|
18 | case 1: return translate("Unexpected shutdown");
|
---|
19 | case 2: return translate("Incorrect network protocol version");
|
---|
20 | case 3: return translate("Game is loading, please try later");
|
---|
21 | @@ -25,11 +29,12 @@
|
---|
22 | *
|
---|
23 | * @param {number} reason
|
---|
24 | */
|
---|
25 | -function reportDisconnect(reason)
|
---|
26 | +function reportDisconnect(reason, wasConnected)
|
---|
27 | {
|
---|
28 | // Translation: States the reason why the client disconnected from the server.
|
---|
29 | - var reasonText = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(reason) })
|
---|
30 | - messageBox(400, 200, translate("Lost connection to the server.") + "\n\n" + reasonText, translate("Disconnected"), 2);
|
---|
31 | + var reasonText = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(reason, wasConnected) })
|
---|
32 | + messageBox(400, 200, (wasConnected ? translate("Lost connection to the server.") : translate("Failed to connect to server")) + "\n\n" + reasonText, translate("Disconnected"), 2);
|
---|
33 | }
|
---|
34 |
|
---|
35 | /**
|
---|
36 | Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js
|
---|
37 | ===================================================================
|
---|
38 | --- binaries/data/mods/public/gui/gamesetup/gamesetup.js (revision 17233)
|
---|
39 | +++ binaries/data/mods/public/gui/gamesetup/gamesetup.js (working copy)
|
---|
40 | @@ -424,7 +424,7 @@
|
---|
41 | {
|
---|
42 | case "disconnected":
|
---|
43 | cancelSetup();
|
---|
44 | - reportDisconnect(message.reason);
|
---|
45 | + reportDisconnect(message.reason, true);
|
---|
46 | break;
|
---|
47 |
|
---|
48 | default:
|
---|
49 | Index: binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js
|
---|
50 | ===================================================================
|
---|
51 | --- binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js (revision 17233)
|
---|
52 | +++ binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js (working copy)
|
---|
53 | @@ -90,7 +90,7 @@
|
---|
54 | {
|
---|
55 | case "disconnected":
|
---|
56 | cancelSetup();
|
---|
57 | - reportDisconnect(message.reason);
|
---|
58 | + reportDisconnect(message.reason, false);
|
---|
59 | return;
|
---|
60 |
|
---|
61 | default:
|
---|
62 | @@ -161,7 +161,7 @@
|
---|
63 |
|
---|
64 | case "disconnected":
|
---|
65 | cancelSetup();
|
---|
66 | - reportDisconnect(message.reason);
|
---|
67 | + reportDisconnect(message.reason, false);
|
---|
68 | return;
|
---|
69 |
|
---|
70 | default:
|
---|
71 | Index: binaries/data/mods/public/gui/session/messages.js
|
---|
72 | ===================================================================
|
---|
73 | --- binaries/data/mods/public/gui/session/messages.js (revision 17233)
|
---|
74 | +++ binaries/data/mods/public/gui/session/messages.js (working copy)
|
---|
75 | @@ -270,7 +270,7 @@
|
---|
76 | case "disconnected":
|
---|
77 | g_Disconnected = true;
|
---|
78 | // Translation: States the reason why the client disconnected from the server.
|
---|
79 | - let reason = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(message.reason) });
|
---|
80 | + let reason = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(message.reason, true) });
|
---|
81 | obj.caption = translate("Connection to the server has been lost.") + "\n" + reason + "\n" + translate("The game has ended.");
|
---|
82 | obj.hidden = false;
|
---|
83 | break;
|
---|