Merge pull request #1 from ddnet/master

Merge ddnet/ddnet
This commit is contained in:
ACTom 2016-09-01 21:08:53 +08:00 committed by GitHub
commit 02107fd2c9
2 changed files with 4 additions and 1 deletions

View file

@ -685,10 +685,11 @@ void CCharacter::SetEmote(int Emote, int Tick)
void CCharacter::OnPredictedInput(CNetObj_PlayerInput *pNewInput)
{
// check for changes
if(mem_comp(&m_Input, pNewInput, sizeof(CNetObj_PlayerInput)) != 0)
if(mem_comp(&m_SavedInput, pNewInput, sizeof(CNetObj_PlayerInput)) != 0)
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++;
@ -1994,6 +1995,7 @@ void CCharacter::SendZoneMsgs()
void CCharacter::DDRaceTick()
{
mem_copy(&m_Input, &m_SavedInput, sizeof(m_Input));
m_Armor=(m_FreezeTime >= 0)?10-(m_FreezeTime/15):0;
if(m_Input.m_Direction != 0 || m_Input.m_Jump != 0)
m_LastMove = Server()->Tick();

View file

@ -130,6 +130,7 @@ private:
// input
CNetObj_PlayerInput m_PrevInput;
CNetObj_PlayerInput m_Input;
CNetObj_PlayerInput m_SavedInput;
int m_NumInputs;
int m_Jumped;