From c921f6d81794223590abc4ced95daba0b91e4767 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 14 Jul 2021 21:23:44 +0200 Subject: Add: inform clients what game-script a server is running (#9441) Co-authored-by: The Dude --- src/network/core/game_info.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/network/core/game_info.cpp') diff --git a/src/network/core/game_info.cpp b/src/network/core/game_info.cpp index 17f00c5f5..32b8fdb75 100644 --- a/src/network/core/game_info.cpp +++ b/src/network/core/game_info.cpp @@ -16,6 +16,8 @@ #include "../../date_func.h" #include "../../debug.h" #include "../../map_func.h" +#include "../../game/game.hpp" +#include "../../game/game_info.hpp" #include "../../settings_type.h" #include "../../string_func.h" #include "../../rev.h" @@ -195,6 +197,11 @@ void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info) /* Update the documentation in game_info.h on changes * to the NetworkGameInfo wire-protocol! */ + /* NETWORK_GAME_INFO_VERSION = 5 */ + GameInfo *game_info = Game::GetInfo(); + p->Send_uint32(game_info == nullptr ? -1 : (uint32)game_info->GetVersion()); + p->Send_string(game_info == nullptr ? "" : game_info->GetName()); + /* NETWORK_GAME_INFO_VERSION = 4 */ { /* Only send the GRF Identification (GRF_ID and MD5 checksum) of @@ -260,6 +267,12 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info) * to the NetworkGameInfo wire-protocol! */ switch (game_info_version) { + case 5: { + info->gamescript_version = (int)p->Recv_uint32(); + info->gamescript_name = p->Recv_string(NETWORK_NAME_LENGTH); + FALLTHROUGH; + } + case 4: { GRFConfig **dst = &info->grfconfig; uint i; -- cgit v1.2.3-54-g00ecf