mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-11 10:38:20 +00:00
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#ifndef ENGINE_SHARED_SERVERINFO_H
|
|
#define ENGINE_SHARED_SERVERINFO_H
|
|
|
|
#include "protocol.h"
|
|
#include <engine/map.h>
|
|
|
|
typedef struct _json_value json_value;
|
|
class CServerInfo;
|
|
|
|
class CServerInfo2
|
|
{
|
|
public:
|
|
class CClient
|
|
{
|
|
public:
|
|
char m_aName[MAX_NAME_LENGTH];
|
|
char m_aClan[MAX_CLAN_LENGTH];
|
|
int m_Country;
|
|
int m_Score;
|
|
bool m_IsPlayer;
|
|
char m_aSkin[24 + 1];
|
|
bool m_CustomSkinColors;
|
|
int m_CustomSkinColorBody;
|
|
int m_CustomSkinColorFeet;
|
|
};
|
|
|
|
CClient m_aClients[SERVERINFO_MAX_CLIENTS];
|
|
int m_MaxClients;
|
|
int m_NumClients; // Indirectly serialized.
|
|
int m_MaxPlayers;
|
|
int m_NumPlayers; // Not serialized.
|
|
bool m_Passworded;
|
|
char m_aGameType[16];
|
|
char m_aName[64];
|
|
char m_aMapName[MAX_MAP_LENGTH];
|
|
char m_aVersion[32];
|
|
|
|
bool operator==(const CServerInfo2 &Other) const;
|
|
bool operator!=(const CServerInfo2 &Other) const { return !(*this == Other); }
|
|
static bool FromJson(CServerInfo2 *pOut, const json_value *pJson);
|
|
static bool FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson);
|
|
bool Validate() const;
|
|
void ToJson(char *pBuffer, int BufferSize) const;
|
|
|
|
operator CServerInfo() const;
|
|
};
|
|
|
|
bool ParseCrc(unsigned int *pResult, const char *pString);
|
|
|
|
#endif // ENGINE_SHARED_SERVERINFO_H
|