mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Make a copy of the input only after sanitizing it
This fixes a physics bug that allowed players to set their mouse direction to (NaN, NaN), resulting in funny effects.
This commit is contained in:
parent
b51b3cf0c1
commit
1ae004ba46
|
@ -681,13 +681,14 @@ void CCharacter::OnPredictedInput(CNetObj_PlayerInput *pNewInput)
|
|||
m_LastAction = Server()->Tick();
|
||||
|
||||
// copy new input
|
||||
mem_copy(&m_SavedInput, pNewInput, sizeof(m_SavedInput));
|
||||
mem_copy(&m_Input, pNewInput, sizeof(m_Input));
|
||||
m_NumInputs++;
|
||||
|
||||
// it is not allowed to aim in the center
|
||||
if(m_Input.m_TargetX == 0 && m_Input.m_TargetY == 0)
|
||||
m_Input.m_TargetY = -1;
|
||||
|
||||
mem_copy(&m_SavedInput, m_Input, sizeof(m_SavedInput));
|
||||
}
|
||||
|
||||
void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
|
||||
|
|
Loading…
Reference in a new issue