From 5c87bcf377e164de5c2833dd238161c96038094a Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 9 Jul 2006 08:28:43 +0000 Subject: [PATCH] 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 --- cl_input.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.39.2