diff options
author | Rubidium <rubidium@openttd.org> | 2021-07-17 23:42:43 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-07-18 19:36:38 +0200 |
commit | 386ef4dac3c42a4454fb9cdfdcf7d6acfa9a3d0a (patch) | |
tree | 361a942eceb10b1499b88417e2148aa2bdc7d250 /src/network/core/game_info.cpp | |
parent | 3eaa4706325556bfb1351d2ff392b5bc205fd238 (diff) | |
download | openttd-386ef4dac3c42a4454fb9cdfdcf7d6acfa9a3d0a.tar.xz |
Feature: [Game Coordinator] Send NewGRF names to the client
Diffstat (limited to 'src/network/core/game_info.cpp')
-rw-r--r-- | src/network/core/game_info.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/network/core/game_info.cpp b/src/network/core/game_info.cpp index 138053b05..85d66807b 100644 --- a/src/network/core/game_info.cpp +++ b/src/network/core/game_info.cpp @@ -254,7 +254,7 @@ void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool * @param p the packet to read the data from. * @param info the NetworkGameInfo to deserialize into. */ -void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info) +void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfoNewGRFLookupTable *newgrf_lookup_table) { static const Date MAX_DATE = ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11 @@ -300,6 +300,14 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info) DeserializeGRFIdentifierWithName(p, &grf); break; + case NST_LOOKUP_ID: { + if (newgrf_lookup_table == nullptr) return; + auto it = newgrf_lookup_table->find(p->Recv_uint32()); + if (it == newgrf_lookup_table->end()) return; + grf = it->second; + break; + } + default: NOT_REACHED(); } |