Skip to content

Commit 30b64a7

Browse files
committed
move if statement inside function and rename apply predict inputs function
1 parent eb03d26 commit 30b64a7

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

src/game/client/gameclient.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,8 +2417,11 @@ void CGameClient::UpdateEditorIngameMoved()
24172417
}
24182418
}
24192419

2420-
void CGameClient::ApplyPredictInputs(int Tick, bool Direct, CGameWorld& GameWorld)
2420+
void CGameClient::ApplyPreInputs(int Tick, bool Direct, CGameWorld& GameWorld)
24212421
{
2422+
if(!g_Config.m_ClAntiPingPreInput)
2423+
return;
2424+
24222425
for(int i = 0; i < MAX_CLIENTS; i++)
24232426
{
24242427
if(CCharacter *pChar = GameWorld.GetCharacterById(i))
@@ -2548,21 +2551,15 @@ void CGameClient::OnPredict()
25482551
if(pDummyInputData && !DummyFirst)
25492552
pDummyChar->OnDirectInput(pDummyInputData);
25502553

2551-
if(g_Config.m_ClAntiPingPreInput)
2552-
{
2553-
ApplyPredictInputs(Tick, true, m_PredictedWorld);
2554-
}
2554+
ApplyPreInputs(Tick, true, m_PredictedWorld);
25552555

25562556
m_PredictedWorld.m_GameTick = Tick;
25572557
if(pInputData)
25582558
pLocalChar->OnPredictedInput(pInputData);
25592559
if(pDummyInputData)
25602560
pDummyChar->OnPredictedInput(pDummyInputData);
25612561

2562-
if(g_Config.m_ClAntiPingPreInput)
2563-
{
2564-
ApplyPredictInputs(Tick, false, m_PredictedWorld);
2565-
}
2562+
ApplyPreInputs(Tick, false, m_PredictedWorld);
25662563

25672564
m_PredictedWorld.Tick();
25682565

@@ -3423,21 +3420,15 @@ void CGameClient::UpdatePrediction()
34233420
if(pDummyInput)
34243421
pDummyChar->OnDirectInput(pDummyInput);
34253422

3426-
if(g_Config.m_ClAntiPingPreInput)
3427-
{
3428-
ApplyPredictInputs(Tick, true, m_GameWorld);
3429-
}
3423+
ApplyPreInputs(Tick, true, m_GameWorld);
34303424

34313425
m_GameWorld.m_GameTick = Tick;
34323426
if(pInput)
34333427
pLocalChar->OnPredictedInput(pInput);
34343428
if(pDummyInput)
34353429
pDummyChar->OnPredictedInput(pDummyInput);
34363430

3437-
if(g_Config.m_ClAntiPingPreInput)
3438-
{
3439-
ApplyPredictInputs(Tick, false, m_GameWorld);
3440-
}
3431+
ApplyPreInputs(Tick, false, m_GameWorld);
34413432

34423433
m_GameWorld.Tick();
34433434

src/game/client/gameclient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ class CGameClient : public IGameClient
653653
void SendKill() const;
654654
void SendReadyChange7();
655655

656-
void ApplyPredictInputs(int Tick, bool Direct, CGameWorld& GameWorld);
656+
void ApplyPreInputs(int Tick, bool Direct, CGameWorld& GameWorld);
657657

658658
int m_aNextChangeInfo[NUM_DUMMIES];
659659

0 commit comments

Comments
 (0)