summaryrefslogtreecommitdiff
path: root/src/network/network_coordinator.cpp
diff options
context:
space:
mode:
authorRubidium <rubidium@openttd.org>2021-07-17 23:42:43 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-07-18 19:36:38 +0200
commit386ef4dac3c42a4454fb9cdfdcf7d6acfa9a3d0a (patch)
tree361a942eceb10b1499b88417e2148aa2bdc7d250 /src/network/network_coordinator.cpp
parent3eaa4706325556bfb1351d2ff392b5bc205fd238 (diff)
downloadopenttd-386ef4dac3c42a4454fb9cdfdcf7d6acfa9a3d0a.tar.xz
Feature: [Game Coordinator] Send NewGRF names to the client
Diffstat (limited to 'src/network/network_coordinator.cpp')
-rw-r--r--src/network/network_coordinator.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/network/network_coordinator.cpp b/src/network/network_coordinator.cpp
index ab0f21050..21937c7c6 100644
--- a/src/network/network_coordinator.cpp
+++ b/src/network/network_coordinator.cpp
@@ -231,7 +231,7 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_LISTING(Packet *p)
/* Read the NetworkGameInfo from the packet. */
NetworkGameInfo ngi = {};
- DeserializeNetworkGameInfo(p, &ngi);
+ DeserializeNetworkGameInfo(p, &ngi, &this->newgrf_lookup_table);
/* Now we know the connection string, we can add it to our list. */
NetworkGameList *item = NetworkGameListAddItem(connection_string);
@@ -347,6 +347,18 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_STUN_CONNECT(Packet *p)
return true;
}
+bool ClientNetworkCoordinatorSocketHandler::Receive_GC_NEWGRF_LOOKUP(Packet *p)
+{
+ this->newgrf_lookup_table_cursor = p->Recv_uint32();
+
+ uint16 newgrfs = p->Recv_uint16();
+ for (; newgrfs> 0; newgrfs--) {
+ uint32 index = p->Recv_uint32();
+ DeserializeGRFIdentifierWithName(p, &this->newgrf_lookup_table[index]);
+ }
+ return true;
+}
+
void ClientNetworkCoordinatorSocketHandler::Connect()
{
/* We are either already connected or are trying to connect. */
@@ -433,6 +445,7 @@ void ClientNetworkCoordinatorSocketHandler::GetListing()
p->Send_uint8(NETWORK_COORDINATOR_VERSION);
p->Send_uint8(NETWORK_GAME_INFO_VERSION);
p->Send_string(_openttd_revision);
+ p->Send_uint32(this->newgrf_lookup_table_cursor);
this->SendPacket(p);
}