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:
heinrich5991 2017-08-25 13:20:10 +02:00
parent b51b3cf0c1
commit 1ae004ba46

View file

@ -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)