mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #2372
2372: Fix out of bounds access in RenderPlayer (fixes #2365) r=Learath2 a=def- Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
b4472d72cf
|
@ -197,7 +197,7 @@ void CPlayers::RenderPlayer(
|
||||||
bool PredictLocalWeapons = false;
|
bool PredictLocalWeapons = false;
|
||||||
float AttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + Client()->GameTickTime(g_Config.m_ClDummy);
|
float AttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + Client()->GameTickTime(g_Config.m_ClDummy);
|
||||||
float LastAttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime;
|
float LastAttackTime = (Client()->PrevGameTick(g_Config.m_ClDummy) - Player.m_AttackTick) / (float)SERVER_TICK_SPEED + s_LastGameTickTime;
|
||||||
if(m_pClient->m_aClients[ClientID].m_IsPredictedLocal && m_pClient->AntiPingGunfire())
|
if(ClientID >= 0 && m_pClient->m_aClients[ClientID].m_IsPredictedLocal && m_pClient->AntiPingGunfire())
|
||||||
{
|
{
|
||||||
PredictLocalWeapons = true;
|
PredictLocalWeapons = true;
|
||||||
AttackTime = (Client()->PredIntraGameTick(g_Config.m_ClDummy) + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED;
|
AttackTime = (Client()->PredIntraGameTick(g_Config.m_ClDummy) + (Client()->PredGameTick(g_Config.m_ClDummy) - 1 - Player.m_AttackTick)) / (float)SERVER_TICK_SPEED;
|
||||||
|
@ -230,7 +230,7 @@ void CPlayers::RenderPlayer(
|
||||||
|
|
||||||
vec2 Direction = GetDirection((int)(Angle*256.0f));
|
vec2 Direction = GetDirection((int)(Angle*256.0f));
|
||||||
vec2 Position;
|
vec2 Position;
|
||||||
if(in_range(ClientID, MAX_CLIENTS-1))
|
if(ClientID >= 0)
|
||||||
Position = m_pClient->m_aClients[ClientID].m_RenderPos;
|
Position = m_pClient->m_aClients[ClientID].m_RenderPos;
|
||||||
else
|
else
|
||||||
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
|
Position = mix(vec2(Prev.m_X, Prev.m_Y), vec2(Player.m_X, Player.m_Y), IntraTick);
|
||||||
|
|
Loading…
Reference in a new issue