From: havoc Date: Sun, 9 Jul 2006 08:28:43 +0000 (+0000) Subject: cleaned up cl_netinputpacketspersecond code a little for more readability (no change... X-Git-Tag: xonotic-v0.1.0preview~3874 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5c87bcf377e164de5c2833dd238161c96038094a;p=xonotic%2Fdarkplaces.git cleaned up cl_netinputpacketspersecond code a little for more readability (no change in behavior) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6506 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_input.c b/cl_input.c index 2824743c..d78b917f 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1219,11 +1219,13 @@ void CL_SendMove(void) } else { - if (realtime < lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100)) + double packettime = 1.0 / bound(10, cl_netinputpacketspersecond.value, 100); + // don't send too often or else network connections can get clogged by a high renderer framerate + if (realtime < lastsendtime + packettime) return; // don't let it fall behind if CL_SendMove hasn't been called recently // (such is the case when framerate is too low for instance) - lastsendtime = max(lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100), realtime); + lastsendtime = max(lastsendtime + packettime, realtime); } #if MOVEAVERAGING // average the accumulated changes