summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-05 23:21:14 +0200
committerGitHub <noreply@github.com>2021-05-05 23:21:14 +0200
commitf94fb9377910c63fc8e1ea0ede1d96603e4d8862 (patch)
tree9b8041b53749744b4df075520181294806332e07 /src/network/network_client.cpp
parentead30dc725c60cac8bc13c86d18b179dac684bec (diff)
downloadopenttd-f94fb9377910c63fc8e1ea0ede1d96603e4d8862.tar.xz
Codechange: use connection_string in favour of NetworkAddress (#9197)
We now resolve the connection_string to a NetworkAddress in a much later state. This means there are fewer places constructing a NetworkAddress. The main benefit of this is in later PRs that introduce different types of NetworkAddresses. Storing this in things like NetworkGameList is rather complex, especially as NetworkAddress has to be mutable at all times. Additionally, the NetworkAddress is a complex object to store simple information: how to connect to this server.
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index d288c71a6..190bb2945 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -145,7 +145,7 @@ void ClientNetworkEmergencySave()
* Create a new socket for the client side of the game connection.
* @param s The socket to connect with.
*/
-ClientNetworkGameSocketHandler::ClientNetworkGameSocketHandler(SOCKET s, NetworkAddress address) : NetworkGameSocketHandler(s), address(address), savegame(nullptr), status(STATUS_INACTIVE)
+ClientNetworkGameSocketHandler::ClientNetworkGameSocketHandler(SOCKET s, const std::string &connection_string) : NetworkGameSocketHandler(s), connection_string(connection_string), savegame(nullptr), status(STATUS_INACTIVE)
{
assert(ClientNetworkGameSocketHandler::my_client == nullptr);
ClientNetworkGameSocketHandler::my_client = this;
@@ -581,7 +581,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_GAME_INFO(Packe
NetworkGameList *item = GetLobbyGameInfo();
if (item == nullptr) {
/* This is not the lobby, so add it to the game list. */
- item = NetworkGameListAddItem(this->address);
+ item = NetworkGameListAddItem(this->connection_string);
}
/* Clear any existing GRFConfig chain. */