mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix serverinfo json parser to work with system libjsonparser (fixes #4202)
Debian, Ubuntu, Fedora are using libjsonparser without our own changes, thus we were doing garbage.
This commit is contained in:
parent
fb23d4637b
commit
e9ffcc3c50
6
src/engine/external/json-parser/json.h
vendored
6
src/engine/external/json-parser/json.h
vendored
|
@ -226,12 +226,6 @@ typedef struct _json_value
|
|||
};
|
||||
}
|
||||
|
||||
/* DDNet additions */
|
||||
inline operator int () const
|
||||
{
|
||||
return (json_int_t) *this;
|
||||
}
|
||||
|
||||
inline operator bool () const
|
||||
{
|
||||
if (type != json_boolean)
|
||||
|
|
|
@ -80,8 +80,8 @@ bool CServerInfo2::FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
pOut->m_MaxClients = MaxClients;
|
||||
pOut->m_MaxPlayers = MaxPlayers;
|
||||
pOut->m_MaxClients = json_int_get(&MaxClients);
|
||||
pOut->m_MaxPlayers = json_int_get(&MaxPlayers);
|
||||
pOut->m_Passworded = Passworded;
|
||||
str_copy(pOut->m_aGameType, GameType, sizeof(pOut->m_aGameType));
|
||||
str_copy(pOut->m_aName, Name, sizeof(pOut->m_aName));
|
||||
|
@ -113,8 +113,8 @@ bool CServerInfo2::FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson)
|
|||
CClient *pClient = &pOut->m_aClients[i];
|
||||
str_copy(pClient->m_aName, Name, sizeof(pClient->m_aName));
|
||||
str_copy(pClient->m_aClan, Clan, sizeof(pClient->m_aClan));
|
||||
pClient->m_Country = Country;
|
||||
pClient->m_Score = Score;
|
||||
pClient->m_Country = json_int_get(&Country);
|
||||
pClient->m_Score = json_int_get(&Score);
|
||||
pClient->m_IsPlayer = IsPlayer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue