Codechange: track servers with a ServerAddress instead of a NetworkAddress

This allows future extensions to have different ways of referencing
a server, instead of forcing to use IP:port.
This commit is contained in:
Patric Stout
2021-04-28 14:36:14 +02:00
committed by Patric Stout
parent f4dd2d88c7
commit cee8174d02
6 changed files with 93 additions and 26 deletions

View File

@@ -26,7 +26,7 @@ int _network_game_list_version = 0; ///< Current version of all items in the lis
/**
* Add a new item to the linked gamelist. If the IP and Port match
* return the existing item instead of adding it again
* @param address the address of the to-be added item
* @param connection_string the address of the to-be added item
* @return a point to the newly added or already existing item
*/
NetworkGameList *NetworkGameListAddItem(const std::string &connection_string)
@@ -34,7 +34,7 @@ NetworkGameList *NetworkGameListAddItem(const std::string &connection_string)
NetworkGameList *item, *prev_item;
/* Parse the connection string to ensure the default port is there. */
const std::string resolved_connection_string = ParseConnectionString(connection_string, NETWORK_DEFAULT_PORT).GetAddressAsString(false);
const std::string resolved_connection_string = ServerAddress::Parse(connection_string, NETWORK_DEFAULT_PORT).connection_string;
prev_item = nullptr;
for (item = _network_game_list; item != nullptr; item = item->next) {