From: havoc Date: Fri, 5 Nov 2004 00:21:19 +0000 (+0000) Subject: imposed a 20 frames at once limit in Host_ServerFrame X-Git-Tag: xonotic-v0.1.0preview~5396 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=cd4716322dec1ce6da1b9acdfe0a9a91af9d5663;p=xonotic%2Fdarkplaces.git 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 --- 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