MCPcopy Create free account
hub / github.com/ddnet/ddnet / GetInput

Method GetInput

src/engine/client/client.cpp:385–398  ·  view source on GitHub ↗

TODO: OPT: do this a lot smarter!

Source from the content-addressed store, hash-verified

383
384// TODO: OPT: do this a lot smarter!
385int *CClient::GetInput(int Tick, int IsDummy) const
386{
387 int Best = -1;
388 const int d = IsDummy ^ g_Config.m_ClDummy;
389 for(int i = 0; i < 200; i++)
390 {
391 if(m_aInputs[d][i].m_Tick != -1 && m_aInputs[d][i].m_Tick <= Tick && (Best == -1 || m_aInputs[d][Best].m_Tick < m_aInputs[d][i].m_Tick))
392 Best = i;
393 }
394
395 if(Best != -1)
396 return (int *)m_aInputs[d][Best].m_aData;
397 return nullptr;
398}
399
400// ------ state handling -----
401void CClient::SetState(EClientState State)

Callers 2

OnPredictMethod · 0.80
UpdatePredictionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected