diff options
author | Patric Stout <truebrain@openttd.org> | 2021-05-05 23:21:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 23:21:14 +0200 |
commit | f94fb9377910c63fc8e1ea0ede1d96603e4d8862 (patch) | |
tree | 9b8041b53749744b4df075520181294806332e07 /src/network/network_client.cpp | |
parent | ead30dc725c60cac8bc13c86d18b179dac684bec (diff) | |
download | openttd-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.cpp | 4 |
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. */ |