summaryrefslogtreecommitdiff
path: root/src/network/network_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/network_gui.cpp')
-rw-r--r--src/network/network_gui.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index ac86b868c..526f141cd 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -272,7 +272,9 @@ protected:
static bool NGameNameSorter(NetworkGameList * const &a, NetworkGameList * const &b)
{
int r = strnatcmp(a->info.server_name, b->info.server_name, true); // Sort by name (natural sorting).
- return r == 0 ? a->address.CompareTo(b->address) < 0: r < 0;
+ if (r == 0) r = a->connection_string.compare(b->connection_string);
+
+ return r < 0;
}
/**
@@ -646,8 +648,7 @@ public:
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_SERVER_VERSION); // server version
y += FONT_HEIGHT_NORMAL;
- std::string address = sel->address.GetAddressAsString();
- SetDParamStr(0, address.c_str());
+ SetDParamStr(0, sel->connection_string.c_str());
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_SERVER_ADDRESS); // server address
y += FONT_HEIGHT_NORMAL;
@@ -751,7 +752,7 @@ public:
break;
case WID_NG_REFRESH: // Refresh
- if (this->server != nullptr) NetworkTCPQueryServer(this->server->address);
+ if (this->server != nullptr) NetworkTCPQueryServer(this->server->connection_string);
break;
case WID_NG_NEWGRF: // NewGRF Settings
@@ -1471,22 +1472,22 @@ struct NetworkLobbyWindow : public Window {
case WID_NL_JOIN: // Join company
/* Button can be clicked only when it is enabled. */
- NetworkClientConnectGame(this->server->address, this->company);
+ NetworkClientConnectGame(this->server->connection_string, this->company);
break;
case WID_NL_NEW: // New company
- NetworkClientConnectGame(this->server->address, COMPANY_NEW_COMPANY);
+ NetworkClientConnectGame(this->server->connection_string, COMPANY_NEW_COMPANY);
break;
case WID_NL_SPECTATE: // Spectate game
- NetworkClientConnectGame(this->server->address, COMPANY_SPECTATOR);
+ NetworkClientConnectGame(this->server->connection_string, COMPANY_SPECTATOR);
break;
case WID_NL_REFRESH: // Refresh
/* Clear the information so removed companies don't remain */
for (auto &company : this->company_info) company = {};
- NetworkTCPQueryServer(this->server->address, true);
+ NetworkTCPQueryServer(this->server->connection_string, true);
break;
}
}
@@ -1554,9 +1555,9 @@ static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_START);
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
- strecpy(_settings_client.network.last_joined, ngl->address.GetAddressAsString(false).c_str(), lastof(_settings_client.network.last_joined));
+ strecpy(_settings_client.network.last_joined, ngl->connection_string.c_str(), lastof(_settings_client.network.last_joined));
- NetworkTCPQueryServer(ngl->address, true);
+ NetworkTCPQueryServer(ngl->connection_string, true);
new NetworkLobbyWindow(&_network_lobby_window_desc, ngl);
}