From afe16ba79acdbccd2aa535ee1ac736687a5c1dfc Mon Sep 17 00:00:00 2001
From: havoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Mon, 2 Feb 2004 04:32:50 +0000
Subject: [PATCH] fixed sv_freezenonclients (now freezes time as well)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3855 d7cf8633-e32d-0410-b094-e92efae38249
---
 sv_phys.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/sv_phys.c b/sv_phys.c
index e1ef0f96..82b74882 100644
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1391,20 +1391,23 @@ void SV_Physics (void)
 		if (pr_global_struct->force_retouch)
 			SV_LinkEdict (ent, true);	// force retouch even for stationary
 
-		if (i <= svs.maxclients && i > 0)
+		if (i <= svs.maxclients)
 		{
-			if (!svs.clients[i-1].spawned)
-				continue;
-			// connected slot
-			// call standard client pre-think
-			SV_CheckVelocity (ent);
-			pr_global_struct->time = sv.time;
-			pr_global_struct->self = EDICT_TO_PROG(ent);
-			PR_ExecuteProgram (pr_global_struct->PlayerPreThink, "QC function PlayerPreThink is missing");
-			SV_CheckVelocity (ent);
+			if (i > 0)
+			{
+				if (!svs.clients[i-1].spawned)
+					continue;
+				// connected slot
+				// call standard client pre-think
+				SV_CheckVelocity (ent);
+				pr_global_struct->time = sv.time;
+				pr_global_struct->self = EDICT_TO_PROG(ent);
+				PR_ExecuteProgram (pr_global_struct->PlayerPreThink, "QC function PlayerPreThink is missing");
+				SV_CheckVelocity (ent);
+			}
 		}
 		else if (sv_freezenonclients.integer)
-			break;
+			continue;
 
 		// LordHavoc: merged client and normal entity physics
 		switch ((int) ent->v->movetype)
@@ -1469,7 +1472,7 @@ void SV_Physics (void)
 			break;
 		}
 
-		if (i > 0 && i <= svs.maxclients && !ent->e->free)
+		if (i <= svs.maxclients && i > 0 && !ent->e->free)
 		{
 			SV_CheckVelocity (ent);
 
@@ -1496,7 +1499,8 @@ void SV_Physics (void)
 		PR_ExecuteProgram ((func_t)(EndFrameQC - pr_functions), "");
 	}
 
-	sv.time += sv.frametime;
+	if (!sv_freezenonclients.integer)
+		sv.time += sv.frametime;
 }
 
 
-- 
2.39.5