Codechange: track version of network servers to prune once out-of-date

This commit is contained in:
Patric Stout
2021-04-29 16:30:42 +02:00
committed by Patric Stout
parent cbaac5609f
commit e1e2212e0e
5 changed files with 41 additions and 5 deletions

View File

@@ -699,9 +699,11 @@ void NetworkQueryLobbyServer(const std::string &connection_string)
* the list. If you use this function, the games will be marked
* as manually added.
* @param connection_string The IP:port of the server to add.
* @param manually Whether the enter should be marked as manual added.
* @param never_expire Whether the entry can expire (removed when no longer found in the public listing).
* @return The entry on the game list.
*/
NetworkGameList *NetworkAddServer(const std::string &connection_string, bool manually)
NetworkGameList *NetworkAddServer(const std::string &connection_string, bool manually, bool never_expire)
{
if (connection_string.empty()) return nullptr;
@@ -717,6 +719,7 @@ NetworkGameList *NetworkAddServer(const std::string &connection_string, bool man
}
if (manually) item->manually = true;
if (never_expire) item->version = INT32_MAX;
return item;
}
@@ -1288,7 +1291,7 @@ extern "C" {
void CDECL em_openttd_add_server(const char *connection_string)
{
NetworkAddServer(connection_string, false);
NetworkAddServer(connection_string, false, true);
}
}