From e25cc7d795b69e12abe9b7967be8f27214b0b184 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 15 Nov 2004 23:09:21 +0000 Subject: [PATCH] fixed bug that called PlayerPreThink and PlayerPostThink on unspawned clients git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4756 d7cf8633-e32d-0410-b094-e92efae38249 --- sv_phys.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sv_phys.c b/sv_phys.c index c03cdb26..b5427832 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -1412,18 +1412,15 @@ void SV_Physics (void) if (pr_global_struct->force_retouch) SV_LinkEdict (ent, true); // force retouch even for stationary - if (i <= svs.maxclients) + if (i >= 1 && i <= svs.maxclients && svs.clients[i-1].spawned) { - if (i > 0) - { - // 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); - } + // 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) continue; @@ -1492,7 +1489,7 @@ void SV_Physics (void) break; } - if (i <= svs.maxclients && i > 0 && !ent->e->free) + if (i >= 1 && i <= svs.maxclients && svs.clients[i-1].spawned) { SV_CheckVelocity (ent); -- 2.39.2