1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-12-23 15:57:22 +01:00
GiantsTools/Sdk/Include/Network/Public/ServerInfoResponse.h

54 lines
1.5 KiB
C
Raw Normal View History

2020-09-22 07:30:26 +02:00
#pragma once
2021-01-24 00:40:09 +01:00
#include "Core/Public/Version.h"
2020-09-22 07:30:26 +02:00
using njson = nlohmann::json;
struct ServerInfoResponse
{
explicit ServerInfoResponse(const njson& serverInfoResponse)
{
hostIp = serverInfoResponse["hostIpAddress"];
gameName = serverInfoResponse["gameName"];
njson versionJson = serverInfoResponse["version"];
version.build = versionJson["build"];
version.major = versionJson["major"];
version.minor = versionJson["minor"];
version.revision = versionJson["revision"];
sessionName = serverInfoResponse["sessionName"];
port = serverInfoResponse["port"];
mapName = serverInfoResponse["mapName"];
gameType = serverInfoResponse["gameType"];
numPlayers = serverInfoResponse["numPlayers"];
2020-09-23 23:44:31 +02:00
maxPlayers = serverInfoResponse["maxPlayers"];
2020-09-22 07:30:26 +02:00
gameState = serverInfoResponse["gameState"];
timeLimit = serverInfoResponse["timeLimit"];
fragLimit = serverInfoResponse["fragLimit"];
teamFragLimit = serverInfoResponse["teamFragLimit"];
firstBaseComplete = serverInfoResponse["firstBaseComplete"];
for (const auto& playerInfoResponse : serverInfoResponse["playerInfo"])
{
playerInfo.emplace_back(PlayerInfoResponse(playerInfoResponse));
}
}
std::string hostIp;
std::string gameName;
Version version;
std::string sessionName;
int port = 0;
std::string mapName;
std::string gameType;
int numPlayers = 0;
2020-09-23 23:44:31 +02:00
int maxPlayers = 0;
2020-09-22 07:30:26 +02:00
std::string gameState;
int timeLimit = 0;
int fragLimit = 0;
int teamFragLimit = 0;
bool firstBaseComplete = false;
std::vector<PlayerInfoResponse> playerInfo;
};