summaryrefslogtreecommitdiff
path: root/src/network/network_udp.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-04-26 20:02:58 +0200
committerPatric Stout <github@truebrain.nl>2021-04-27 20:18:53 +0200
commitb57d845e55f733514d235e24f64b09a8744f3abc (patch)
treef50ec91958930485070826c308b9cd028e62def9 /src/network/network_udp.cpp
parentb3003dd163ab6b7902da33fa6cfaa29e45556db1 (diff)
downloadopenttd-b57d845e55f733514d235e24f64b09a8744f3abc.tar.xz
Codechange: refactor CheckGameCompatibility() from existing function
Later commits use this function in other places too.
Diffstat (limited to 'src/network/network_udp.cpp')
-rw-r--r--src/network/network_udp.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 8e661e939..d62998794 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -324,10 +324,15 @@ void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAd
/* Find next item */
item = NetworkGameListAddItem(*client_addr);
+ /* Clear any existing GRFConfig chain. */
ClearGRFConfigList(&item->info.grfconfig);
+ /* Retrieve the NetworkGameInfo from the packet. */
DeserializeNetworkGameInfo(p, &item->info);
+ /* Check for compatability with the client. */
+ CheckGameCompatibility(item->info);
+ /* Ensure we consider the server online. */
+ item->online = true;
- item->info.compatible = true;
{
/* Checks whether there needs to be a request for names of GRFs and makes
* the request if necessary. GRFs that need to be requested are the GRFs
@@ -341,7 +346,6 @@ void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAd
uint in_request_count = 0;
for (c = item->info.grfconfig; c != nullptr; c = c->next) {
- if (c->status == GCS_NOT_FOUND) item->info.compatible = false;
if (c->status != GCS_NOT_FOUND || strcmp(c->GetName(), UNKNOWN_GRF_NAME_PLACEHOLDER) != 0) continue;
in_request[in_request_count] = c;
in_request_count++;
@@ -369,12 +373,6 @@ void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAd
strecat(item->info.server_name, " (IPv6)", lastof(item->info.server_name));
}
- /* Check if we are allowed on this server based on the revision-match */
- item->info.version_compatible = IsNetworkCompatibleVersion(item->info.server_revision);
- item->info.compatible &= item->info.version_compatible; // Already contains match for GRFs
-
- item->online = true;
-
UpdateNetworkGameWindow();
}