mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
2373: Fix out of bounds access in OnNewSnapshot (fixes #2366) r=Learath2 a=def- 2376: Add instructions for translation stats r=Learath2 a=def- Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
9fb6fa7720
|
@ -39,3 +39,7 @@ $ ./find_unchanged.py ../spanish.txt
|
|||
To update all languages:
|
||||
|
||||
$ for i in data/languages/*.txt; do scripts/languages/copy_fix.py $i $i.$$.tmp --delete-unused --append-missing && mv $i.$$.tmp $i; done
|
||||
|
||||
To get a statistic of how complete the translation is:
|
||||
|
||||
$ for i in *.txt; do COVERED=$(cat $i|grep "^== "|grep -v "^== $"|wc -l); TOTAL=$(cat $i|grep "^== "|wc -l); [ "$i" != "license.txt" ] && [ "$i" != "index.txt" ] && echo "$(($COVERED*100/$TOTAL))% ${i:r}"; done | sort -n -r
|
||||
|
|
|
@ -1154,42 +1154,49 @@ void CGameClient::OnNewSnapshot()
|
|||
{
|
||||
const CNetObj_ClientInfo *pInfo = (const CNetObj_ClientInfo *)pData;
|
||||
int ClientID = Item.m_ID;
|
||||
IntsToStr(&pInfo->m_Name0, 4, m_aClients[ClientID].m_aName);
|
||||
IntsToStr(&pInfo->m_Clan0, 3, m_aClients[ClientID].m_aClan);
|
||||
m_aClients[ClientID].m_Country = pInfo->m_Country;
|
||||
IntsToStr(&pInfo->m_Skin0, 6, m_aClients[ClientID].m_aSkinName);
|
||||
if(ClientID < MAX_CLIENTS)
|
||||
{
|
||||
CClientData *pClient = &m_aClients[ClientID];
|
||||
|
||||
m_aClients[ClientID].m_UseCustomColor = pInfo->m_UseCustomColor;
|
||||
m_aClients[ClientID].m_ColorBody = pInfo->m_ColorBody;
|
||||
m_aClients[ClientID].m_ColorFeet = pInfo->m_ColorFeet;
|
||||
IntsToStr(&pInfo->m_Name0, 4, pClient->m_aName);
|
||||
IntsToStr(&pInfo->m_Clan0, 3, pClient->m_aClan);
|
||||
pClient->m_Country = pInfo->m_Country;
|
||||
IntsToStr(&pInfo->m_Skin0, 6, pClient->m_aSkinName);
|
||||
|
||||
pClient->m_UseCustomColor = pInfo->m_UseCustomColor;
|
||||
pClient->m_ColorBody = pInfo->m_ColorBody;
|
||||
pClient->m_ColorFeet = pInfo->m_ColorFeet;
|
||||
|
||||
// prepare the info
|
||||
if(m_aClients[ClientID].m_aSkinName[0] == 'x' || m_aClients[ClientID].m_aSkinName[1] == '_')
|
||||
str_copy(m_aClients[ClientID].m_aSkinName, "default", 64);
|
||||
if(pClient->m_aSkinName[0] == 'x' || pClient->m_aSkinName[1] == '_')
|
||||
str_copy(pClient->m_aSkinName, "default", 64);
|
||||
|
||||
m_aClients[ClientID].m_SkinInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSLA(m_aClients[ClientID].m_ColorBody).UnclampLighting());
|
||||
m_aClients[ClientID].m_SkinInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSLA(m_aClients[ClientID].m_ColorFeet).UnclampLighting());
|
||||
m_aClients[ClientID].m_SkinInfo.m_Size = 64;
|
||||
pClient->m_SkinInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSLA(pClient->m_ColorBody).UnclampLighting());
|
||||
pClient->m_SkinInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSLA(pClient->m_ColorFeet).UnclampLighting());
|
||||
pClient->m_SkinInfo.m_Size = 64;
|
||||
|
||||
// find new skin
|
||||
m_aClients[ClientID].m_SkinID = g_GameClient.m_pSkins->Find(m_aClients[ClientID].m_aSkinName);
|
||||
pClient->m_SkinID = g_GameClient.m_pSkins->Find(pClient->m_aSkinName);
|
||||
|
||||
if(m_aClients[ClientID].m_UseCustomColor)
|
||||
m_aClients[ClientID].m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(m_aClients[ClientID].m_SkinID)->m_ColorTexture;
|
||||
if(pClient->m_UseCustomColor)
|
||||
pClient->m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(pClient->m_SkinID)->m_ColorTexture;
|
||||
else
|
||||
{
|
||||
m_aClients[ClientID].m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(m_aClients[ClientID].m_SkinID)->m_OrgTexture;
|
||||
m_aClients[ClientID].m_SkinInfo.m_ColorBody = ColorRGBA(1,1,1);
|
||||
m_aClients[ClientID].m_SkinInfo.m_ColorFeet = ColorRGBA(1,1,1);
|
||||
pClient->m_SkinInfo.m_Texture = g_GameClient.m_pSkins->Get(pClient->m_SkinID)->m_OrgTexture;
|
||||
pClient->m_SkinInfo.m_ColorBody = ColorRGBA(1,1,1);
|
||||
pClient->m_SkinInfo.m_ColorFeet = ColorRGBA(1,1,1);
|
||||
}
|
||||
|
||||
m_aClients[ClientID].UpdateRenderInfo();
|
||||
pClient->UpdateRenderInfo();
|
||||
}
|
||||
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_PLAYERINFO)
|
||||
{
|
||||
const CNetObj_PlayerInfo *pInfo = (const CNetObj_PlayerInfo *)pData;
|
||||
|
||||
if(pInfo->m_ClientID < MAX_CLIENTS)
|
||||
{
|
||||
m_aClients[pInfo->m_ClientID].m_Team = pInfo->m_Team;
|
||||
m_aClients[pInfo->m_ClientID].m_Active = true;
|
||||
m_Snap.m_paPlayerInfos[pInfo->m_ClientID] = pInfo;
|
||||
|
@ -1216,17 +1223,23 @@ void CGameClient::OnNewSnapshot()
|
|||
}
|
||||
else if(m_aStats[pInfo->m_ClientID].IsActive())
|
||||
m_aStats[pInfo->m_ClientID].JoinSpec(Client()->GameTick(g_Config.m_ClDummy));
|
||||
}
|
||||
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_DDNETPLAYER)
|
||||
{
|
||||
const CNetObj_DDNetPlayer *pInfo = (const CNetObj_DDNetPlayer *)pData;
|
||||
if(Item.m_ID < MAX_CLIENTS)
|
||||
{
|
||||
m_aClients[Item.m_ID].m_AuthLevel = pInfo->m_AuthLevel;
|
||||
m_aClients[Item.m_ID].m_Afk = pInfo->m_Flags & EXPLAYERFLAG_AFK;
|
||||
m_aClients[Item.m_ID].m_Paused = pInfo->m_Flags & EXPLAYERFLAG_PAUSED;
|
||||
m_aClients[Item.m_ID].m_Spec = pInfo->m_Flags & EXPLAYERFLAG_SPEC;
|
||||
}
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_CHARACTER)
|
||||
{
|
||||
if(Item.m_ID < MAX_CLIENTS)
|
||||
{
|
||||
const void *pOld = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, Item.m_ID);
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_Cur = *((const CNetObj_Character *)pData);
|
||||
|
@ -1257,45 +1270,54 @@ void CGameClient::OnNewSnapshot()
|
|||
m_aClients[Item.m_ID].m_Evolved.m_Tick = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_DDNETCHARACTER)
|
||||
{
|
||||
const CNetObj_DDNetCharacter *pCharacterData = (const CNetObj_DDNetCharacter *)pData;
|
||||
|
||||
if(Item.m_ID < MAX_CLIENTS)
|
||||
{
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_ExtendedData = *pCharacterData;
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_HasExtendedData = true;
|
||||
|
||||
CClientData *pClient = &m_aClients[Item.m_ID];
|
||||
// Collision
|
||||
m_aClients[Item.m_ID].m_Solo = pCharacterData->m_Flags & CHARACTERFLAG_SOLO;
|
||||
m_aClients[Item.m_ID].m_NoCollision = pCharacterData->m_Flags & CHARACTERFLAG_NO_COLLISION;
|
||||
m_aClients[Item.m_ID].m_NoHammerHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_HAMMER_HIT;
|
||||
m_aClients[Item.m_ID].m_NoGrenadeHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_GRENADE_HIT;
|
||||
m_aClients[Item.m_ID].m_NoLaserHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_LASER_HIT;
|
||||
m_aClients[Item.m_ID].m_NoShotgunHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_SHOTGUN_HIT;
|
||||
m_aClients[Item.m_ID].m_NoHookHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_HOOK;
|
||||
m_aClients[Item.m_ID].m_Super = pCharacterData->m_Flags & CHARACTERFLAG_SUPER;
|
||||
pClient->m_Solo = pCharacterData->m_Flags & CHARACTERFLAG_SOLO;
|
||||
pClient->m_NoCollision = pCharacterData->m_Flags & CHARACTERFLAG_NO_COLLISION;
|
||||
pClient->m_NoHammerHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_HAMMER_HIT;
|
||||
pClient->m_NoGrenadeHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_GRENADE_HIT;
|
||||
pClient->m_NoLaserHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_LASER_HIT;
|
||||
pClient->m_NoShotgunHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_SHOTGUN_HIT;
|
||||
pClient->m_NoHookHit = pCharacterData->m_Flags & CHARACTERFLAG_NO_HOOK;
|
||||
pClient->m_Super = pCharacterData->m_Flags & CHARACTERFLAG_SUPER;
|
||||
|
||||
// Endless
|
||||
m_aClients[Item.m_ID].m_EndlessHook = pCharacterData->m_Flags & CHARACTERFLAG_ENDLESS_HOOK;
|
||||
m_aClients[Item.m_ID].m_EndlessJump = pCharacterData->m_Flags & CHARACTERFLAG_ENDLESS_JUMP;
|
||||
pClient->m_EndlessHook = pCharacterData->m_Flags & CHARACTERFLAG_ENDLESS_HOOK;
|
||||
pClient->m_EndlessJump = pCharacterData->m_Flags & CHARACTERFLAG_ENDLESS_JUMP;
|
||||
|
||||
// Freeze
|
||||
m_aClients[Item.m_ID].m_FreezeEnd = pCharacterData->m_FreezeEnd;
|
||||
m_aClients[Item.m_ID].m_DeepFrozen = pCharacterData->m_FreezeEnd == -1;
|
||||
pClient->m_FreezeEnd = pCharacterData->m_FreezeEnd;
|
||||
pClient->m_DeepFrozen = pCharacterData->m_FreezeEnd == -1;
|
||||
|
||||
// Telegun
|
||||
m_aClients[Item.m_ID].m_HasTelegunGrenade = pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_GRENADE;
|
||||
m_aClients[Item.m_ID].m_HasTelegunGun = pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_GUN;
|
||||
m_aClients[Item.m_ID].m_HasTelegunLaser = pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_LASER;
|
||||
pClient->m_HasTelegunGrenade = pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_GRENADE;
|
||||
pClient->m_HasTelegunGun = pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_GUN;
|
||||
pClient->m_HasTelegunLaser = pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_LASER;
|
||||
|
||||
m_aClients[Item.m_ID].m_Predicted.ReadDDNet(pCharacterData);
|
||||
pClient->m_Predicted.ReadDDNet(pCharacterData);
|
||||
}
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_SPECCHAR)
|
||||
{
|
||||
const CNetObj_SpecChar *pSpecCharData = (const CNetObj_SpecChar *)pData;
|
||||
|
||||
m_aClients[Item.m_ID].m_SpecCharPresent = true;
|
||||
m_aClients[Item.m_ID].m_SpecChar.x = pSpecCharData->m_X;
|
||||
m_aClients[Item.m_ID].m_SpecChar.y = pSpecCharData->m_Y;
|
||||
if(Item.m_ID < MAX_CLIENTS)
|
||||
{
|
||||
CClientData *pClient = &m_aClients[Item.m_ID];
|
||||
pClient->m_SpecCharPresent = true;
|
||||
pClient->m_SpecChar.x = pSpecCharData->m_X;
|
||||
pClient->m_SpecChar.y = pSpecCharData->m_Y;
|
||||
}
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_SPECTATORINFO)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue