// reference: https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/server/player_lagcompensation.cpp
Vector delta = record->m_vecOrigin - prevOrg;
if ( delta.LengthSqr( ) > LAG_COMPENSATION_TELEPORTED_DISTANCE_SQR ) // LAG_COMPENSATION_TELEPORTED_DISTANCE_SQR - ( 64.0f * 64.0f )
{
// lost track, too much difference
return false;
}
// did we find a context smaller than target time ?
if ( record->m_flSimulationTime <= flTargetTime )
break; // hurra, stop
// check if head has same simulation time
if ( track->Count() > 0 )
{
LagRecord &head = track->Element( track->Head( ) );
// check if player changed simulation time since last time updated
if ( head.m_flSimulationTime >= entity->GetSimulationTime( ) )
return; // don't add new entry for same or older time
}