diff options
author | Patric Stout <truebrain@openttd.org> | 2021-05-04 20:43:35 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-05-08 17:26:10 +0200 |
commit | b9ab3bd6b3f28b682bf5e155bf35d7cbb8b8224a (patch) | |
tree | b9447572f8fa515729293740e66b969c8dd0e0b1 /src | |
parent | fc91f1d1b221435dee870d84690e834e753e39da (diff) | |
download | openttd-b9ab3bd6b3f28b682bf5e155bf35d7cbb8b8224a.tar.xz |
Fix: only query a manually added server if it isn't there yet
But always mark it as manually, no matter if it was there or not.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/network.cpp | 9 | ||||
-rw-r--r-- | src/network/network_internal.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp index ba20b0895..daf2e1d3f 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -657,7 +657,7 @@ void NetworkTCPQueryServer(const std::string &connection_string, bool request_co * @param connection_string The IP:port of the server to add. * @return The entry on the game list. */ -NetworkGameList *NetworkAddServer(const std::string &connection_string) +NetworkGameList *NetworkAddServer(const std::string &connection_string, bool manually) { if (connection_string.empty()) return nullptr; @@ -666,13 +666,14 @@ NetworkGameList *NetworkAddServer(const std::string &connection_string) if (item->info.server_name.empty()) { ClearGRFConfigList(&item->info.grfconfig); item->info.server_name = connection_string; - item->manually = true; NetworkRebuildHostList(); UpdateNetworkGameWindow(); + + NetworkTCPQueryServer(connection_string); } - NetworkTCPQueryServer(connection_string); + if (manually) item->manually = true; return item; } @@ -1202,7 +1203,7 @@ extern "C" { void CDECL em_openttd_add_server(const char *connection_string) { - NetworkAddServer(connection_string); + NetworkAddServer(connection_string, false); } } diff --git a/src/network/network_internal.h b/src/network/network_internal.h index 88af965cf..ac5472fe1 100644 --- a/src/network/network_internal.h +++ b/src/network/network_internal.h @@ -90,7 +90,7 @@ extern CompanyMask _network_company_passworded; void NetworkTCPQueryServer(const std::string &connection_string, bool request_company_info = false); void GetBindAddresses(NetworkAddressList *addresses, uint16 port); -struct NetworkGameList *NetworkAddServer(const std::string &connection_string); +struct NetworkGameList *NetworkAddServer(const std::string &connection_string, bool manually = true); void NetworkRebuildHostList(); void UpdateNetworkGameWindow(); |