From cd4716322dec1ce6da1b9acdfe0a9a91af9d5663 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 5 Nov 2004 00:21:19 +0000 Subject: [PATCH] imposed a 20 frames at once limit in Host_ServerFrame git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4734 d7cf8633-e32d-0410-b094-e92efae38249 --- host.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/host.c b/host.c index 1a99f748..a9b94def 100644 --- a/host.c +++ b/host.c @@ -646,6 +646,8 @@ Host_ServerFrame */ void Host_ServerFrame (void) { + // never run more than 20 frames at a time as a sanity limit + int framecount, framelimit = 20; double advancetime; static double frametimetotal = 0, lastservertime = 0; frametimetotal += host_frametime; @@ -659,10 +661,9 @@ void Host_ServerFrame (void) // run the world state // don't allow simulation to run too fast or too slow or logic glitches can occur - while (frametimetotal > 0) + for (framecount = 0;framecount < framelimit && frametimetotal > 0;framecount++, frametimetotal -= advancetime) { advancetime = min(frametimetotal, sys_ticrate.value); - frametimetotal = frametimetotal - advancetime; // only advance time if not paused // the game also pauses in singleplayer when menu or console is used -- 2.39.2