1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Store and send mod list and game version for game rooms

This commit is contained in:
Ivan Savenko
2024-04-15 13:34:16 +03:00
parent 6ba6e0d55b
commit e5f8cefa7f
12 changed files with 139 additions and 11 deletions

View File

@@ -13,6 +13,9 @@
#include "CVCMIServer.h"
#include "../lib/CConfigHandler.h"
#include "../lib/json/JsonUtils.h"
#include "../lib/VCMI_Lib.h"
#include "../lib/modding/CModHandler.h"
#include "../lib/modding/CModInfo.h"
GlobalLobbyProcessor::GlobalLobbyProcessor(CVCMIServer & owner)
: owner(owner)
@@ -125,6 +128,7 @@ void GlobalLobbyProcessor::onConnectionEstablished(const std::shared_ptr<INetwor
toSend["accountID"].String() = getHostAccountID();
toSend["accountCookie"].String() = getHostAccountCookie();
toSend["version"].String() = VCMI_VERSION_STRING;
toSend["mods"] = getHostModList();
sendMessage(connection, toSend);
}
@@ -149,6 +153,19 @@ void GlobalLobbyProcessor::onConnectionEstablished(const std::shared_ptr<INetwor
}
}
JsonNode GlobalLobbyProcessor::getHostModList() const
{
ModCompatibilityInfo info;
for (auto const & modName : VLC->modh->getActiveMods())
{
if(VLC->modh->getModInfo(modName).checkModGameplayAffecting())
info[modName] = VLC->modh->getModInfo(modName).getVerificationInfo();
}
return ModVerificationInfo::jsonSerializeList(info);
}
void GlobalLobbyProcessor::sendGameStarted()
{
JsonNode toSend;