DDraceNetwork Docs
serverinfo.h
Go to the documentation of this file.
1#ifndef ENGINE_SHARED_SERVERINFO_H
2#define ENGINE_SHARED_SERVERINFO_H
3
4#include "protocol.h"
5
6#include <engine/map.h>
8
9typedef struct _json_value json_value;
10class CServerInfo;
11
13{
14public:
15 class CClient
16 {
17 public:
23 bool m_IsAfk;
28 };
29
32 int m_NumClients; // Indirectly serialized.
34 int m_NumPlayers; // Not serialized.
37 char m_aGameType[16];
38 char m_aName[64];
40 char m_aVersion[32];
42
43 bool operator==(const CServerInfo2 &Other) const;
44 bool operator!=(const CServerInfo2 &Other) const { return !(*this == Other); }
45 static bool FromJson(CServerInfo2 *pOut, const json_value *pJson);
46 static bool FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson);
47 bool Validate() const;
48 void ToJson(char *pBuffer, int BufferSize) const;
49
50 operator CServerInfo() const;
51};
52
53bool ParseCrc(unsigned int *pResult, const char *pString);
54
55#endif // ENGINE_SHARED_SERVERINFO_H
Definition: serverinfo.h:16
bool m_IsPlayer
Definition: serverinfo.h:22
char m_aSkin[MAX_SKIN_LENGTH]
Definition: serverinfo.h:24
char m_aName[MAX_NAME_LENGTH]
Definition: serverinfo.h:18
bool m_CustomSkinColors
Definition: serverinfo.h:25
int m_CustomSkinColorFeet
Definition: serverinfo.h:27
int m_Country
Definition: serverinfo.h:20
int m_Score
Definition: serverinfo.h:21
char m_aClan[MAX_CLAN_LENGTH]
Definition: serverinfo.h:19
int m_CustomSkinColorBody
Definition: serverinfo.h:26
bool m_IsAfk
Definition: serverinfo.h:23
Definition: serverinfo.h:13
int m_MaxClients
Definition: serverinfo.h:31
bool Validate() const
Definition: serverinfo.cpp:49
CServerInfo::EClientScoreKind m_ClientScoreKind
Definition: serverinfo.h:35
bool m_Passworded
Definition: serverinfo.h:36
int m_NumClients
Definition: serverinfo.h:32
bool operator==(const CServerInfo2 &Other) const
Definition: serverinfo.cpp:192
char m_aMapName[MAX_MAP_LENGTH]
Definition: serverinfo.h:39
CClient m_aClients[SERVERINFO_MAX_CLIENTS]
Definition: serverinfo.h:30
bool operator!=(const CServerInfo2 &Other) const
Definition: serverinfo.h:44
bool m_RequiresLogin
Definition: serverinfo.h:41
static bool FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson)
Definition: serverinfo.cpp:59
char m_aGameType[16]
Definition: serverinfo.h:37
char m_aVersion[32]
Definition: serverinfo.h:40
void ToJson(char *pBuffer, int BufferSize) const
int m_NumPlayers
Definition: serverinfo.h:34
int m_MaxPlayers
Definition: serverinfo.h:33
static bool FromJson(CServerInfo2 *pOut, const json_value *pJson)
Definition: serverinfo.cpp:39
char m_aName[64]
Definition: serverinfo.h:38
Definition: serverbrowser.h:23
EClientScoreKind
Definition: serverbrowser.h:43
struct _json_value json_value
Definition: serverbrowser.h:17
@ MAX_CLAN_LENGTH
Definition: protocol.h:98
@ SERVERINFO_MAX_CLIENTS
Definition: protocol.h:87
@ MAX_SKIN_LENGTH
Definition: protocol.h:99
@ MAX_NAME_LENGTH
Definition: protocol.h:97
@ MAX_MAP_LENGTH
Definition: map.h:12
bool ParseCrc(unsigned int *pResult, const char *pString)
Definition: serverinfo.cpp:23