Skip to content
Browse files

let the server check if the input aims the center. Closes #889

  • Loading branch information...
1 parent 242e551 commit 99f04a7f87fb7f6b12f3865e255e9a3bd7ac9e9e @oy oy committed Dec 10, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/game/server/entities/character.cpp
View
6 src/game/server/entities/character.cpp
@@ -507,7 +507,7 @@ void CCharacter::OnPredictedInput(CNetObj_PlayerInput *pNewInput)
mem_copy(&m_Input, pNewInput, sizeof(m_Input));
m_NumInputs++;
- // or are not allowed to aim in the center
+ // 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;
}
@@ -517,6 +517,10 @@ void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
mem_copy(&m_LatestInput, pNewInput, sizeof(m_LatestInput));
+ // it is not allowed to aim in the center
+ if(m_LatestInput.m_TargetX == 0 && m_LatestInput.m_TargetY == 0)
+ m_LatestInput.m_TargetY = -1;
+
if(m_NumInputs > 2 && m_pPlayer->GetTeam() != TEAM_SPECTATORS)
{
HandleWeaponSwitch();

0 comments on commit 99f04a7

Please sign in to comment.
Something went wrong with that request. Please try again.