Changeset - r25420:b4938bd4a2ae
[Not reviewed]
master
0 2 0
Patric Stout - 3 years ago 2021-05-04 18:43:35
truebrain@openttd.org
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.
2 files changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/network/network.cpp
Show inline comments
 
@@ -657,7 +657,7 @@ void NetworkTCPQueryServer(const std::st
 
 * @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 
 
	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);
 
}
 

	
 
}
src/network/network_internal.h
Show inline comments
 
@@ -90,7 +90,7 @@ extern CompanyMask _network_company_pass
 
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();
 

	
0 comments (0 inline, 0 general)