mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Use arrays for snap strings
This commit is contained in:
parent
732798444c
commit
8fc437bea6
|
@ -216,17 +216,15 @@ Objects = [
|
||||||
|
|
||||||
NetObject("ClientInfo", [
|
NetObject("ClientInfo", [
|
||||||
# 4*4 = 16 characters
|
# 4*4 = 16 characters
|
||||||
NetTwIntString("m_Name0"), NetTwIntString("m_Name1"), NetTwIntString("m_Name2"),
|
NetArray(NetTwIntString("m_aName"), 4),
|
||||||
NetTwIntString("m_Name3"),
|
|
||||||
|
|
||||||
# 4*3 = 12 characters
|
# 4*3 = 12 characters
|
||||||
NetTwIntString("m_Clan0"), NetTwIntString("m_Clan1"), NetTwIntString("m_Clan2"),
|
NetArray(NetTwIntString("m_aClan"), 3),
|
||||||
|
|
||||||
NetIntAny("m_Country"),
|
NetIntAny("m_Country"),
|
||||||
|
|
||||||
# 4*6 = 24 characters
|
# 4*6 = 24 characters
|
||||||
NetTwIntString("m_Skin0"), NetTwIntString("m_Skin1"), NetTwIntString("m_Skin2"),
|
NetArray(NetTwIntString("m_aSkin"), 6),
|
||||||
NetTwIntString("m_Skin3"), NetTwIntString("m_Skin4"), NetTwIntString("m_Skin5"),
|
|
||||||
|
|
||||||
NetIntRange("m_UseCustomColor", 0, 1),
|
NetIntRange("m_UseCustomColor", 0, 1),
|
||||||
|
|
||||||
|
|
|
@ -1533,13 +1533,13 @@ void CGameClient::OnNewSnapshot()
|
||||||
{
|
{
|
||||||
CClientData *pClient = &m_aClients[ClientId];
|
CClientData *pClient = &m_aClients[ClientId];
|
||||||
|
|
||||||
if(!IntsToStr(&pInfo->m_Name0, 4, pClient->m_aName, std::size(pClient->m_aName)))
|
if(!IntsToStr(pInfo->m_aName, 4, pClient->m_aName, std::size(pClient->m_aName)))
|
||||||
{
|
{
|
||||||
str_copy(pClient->m_aName, "nameless tee");
|
str_copy(pClient->m_aName, "nameless tee");
|
||||||
}
|
}
|
||||||
IntsToStr(&pInfo->m_Clan0, 3, pClient->m_aClan, std::size(pClient->m_aClan));
|
IntsToStr(pInfo->m_aClan, 3, pClient->m_aClan, std::size(pClient->m_aClan));
|
||||||
pClient->m_Country = pInfo->m_Country;
|
pClient->m_Country = pInfo->m_Country;
|
||||||
IntsToStr(&pInfo->m_Skin0, 6, pClient->m_aSkinName, std::size(pClient->m_aSkinName));
|
IntsToStr(pInfo->m_aSkin, 6, pClient->m_aSkinName, std::size(pClient->m_aSkinName));
|
||||||
|
|
||||||
pClient->m_UseCustomColor = pInfo->m_UseCustomColor;
|
pClient->m_UseCustomColor = pInfo->m_UseCustomColor;
|
||||||
pClient->m_ColorBody = pInfo->m_ColorBody;
|
pClient->m_ColorBody = pInfo->m_ColorBody;
|
||||||
|
|
|
@ -146,10 +146,10 @@ int CGameClient::TranslateSnap(CSnapshot *pSnapDstSix, CSnapshot *pSnapSrcSeven,
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
CNetObj_ClientInfo Info6 = {};
|
CNetObj_ClientInfo Info6 = {};
|
||||||
StrToInts(&Info6.m_Name0, 4, Client.m_aName);
|
StrToInts(Info6.m_aName, 4, Client.m_aName);
|
||||||
StrToInts(&Info6.m_Clan0, 3, Client.m_aClan);
|
StrToInts(Info6.m_aClan, 3, Client.m_aClan);
|
||||||
Info6.m_Country = Client.m_Country;
|
Info6.m_Country = Client.m_Country;
|
||||||
StrToInts(&Info6.m_Skin0, 6, Client.m_aSkinName);
|
StrToInts(Info6.m_aSkin, 6, Client.m_aSkinName);
|
||||||
Info6.m_UseCustomColor = Client.m_UseCustomColor;
|
Info6.m_UseCustomColor = Client.m_UseCustomColor;
|
||||||
Info6.m_ColorBody = Client.m_ColorBody;
|
Info6.m_ColorBody = Client.m_ColorBody;
|
||||||
Info6.m_ColorFeet = Client.m_ColorFeet;
|
Info6.m_ColorFeet = Client.m_ColorFeet;
|
||||||
|
|
|
@ -317,10 +317,10 @@ void CPlayer::Snap(int SnappingClient)
|
||||||
if(!pClientInfo)
|
if(!pClientInfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StrToInts(&pClientInfo->m_Name0, 4, Server()->ClientName(m_ClientId));
|
StrToInts(pClientInfo->m_aName, 4, Server()->ClientName(m_ClientId));
|
||||||
StrToInts(&pClientInfo->m_Clan0, 3, Server()->ClientClan(m_ClientId));
|
StrToInts(pClientInfo->m_aClan, 3, Server()->ClientClan(m_ClientId));
|
||||||
pClientInfo->m_Country = Server()->ClientCountry(m_ClientId);
|
pClientInfo->m_Country = Server()->ClientCountry(m_ClientId);
|
||||||
StrToInts(&pClientInfo->m_Skin0, 6, m_TeeInfos.m_aSkinName);
|
StrToInts(pClientInfo->m_aSkin, 6, m_TeeInfos.m_aSkinName);
|
||||||
pClientInfo->m_UseCustomColor = m_TeeInfos.m_UseCustomColor;
|
pClientInfo->m_UseCustomColor = m_TeeInfos.m_UseCustomColor;
|
||||||
pClientInfo->m_ColorBody = m_TeeInfos.m_ColorBody;
|
pClientInfo->m_ColorBody = m_TeeInfos.m_ColorBody;
|
||||||
pClientInfo->m_ColorFeet = m_TeeInfos.m_ColorFeet;
|
pClientInfo->m_ColorFeet = m_TeeInfos.m_ColorFeet;
|
||||||
|
@ -467,9 +467,9 @@ void CPlayer::FakeSnap()
|
||||||
if(!pClientInfo)
|
if(!pClientInfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StrToInts(&pClientInfo->m_Name0, 4, " ");
|
StrToInts(pClientInfo->m_aName, 4, " ");
|
||||||
StrToInts(&pClientInfo->m_Clan0, 3, "");
|
StrToInts(pClientInfo->m_aClan, 3, "");
|
||||||
StrToInts(&pClientInfo->m_Skin0, 6, "default");
|
StrToInts(pClientInfo->m_aSkin, 6, "default");
|
||||||
|
|
||||||
if(m_Paused != PAUSE_PAUSED)
|
if(m_Paused != PAUSE_PAUSED)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
if(ClientId < MAX_CLIENTS)
|
if(ClientId < MAX_CLIENTS)
|
||||||
{
|
{
|
||||||
CClientData *pClient = &m_aClients[ClientId];
|
CClientData *pClient = &m_aClients[ClientId];
|
||||||
IntsToStr(&pInfo->m_Name0, 4, pClient->m_aName, sizeof(pClient->m_aName));
|
IntsToStr(pInfo->m_aName, 4, pClient->m_aName, sizeof(pClient->m_aName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue