From: Mario Date: Mon, 8 Aug 2016 03:42:03 +0000 (+1000) Subject: Alternative fix: don't modify the player state if it's not owned by the client X-Git-Tag: xonotic-v0.8.2~736 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4feb5d172e5397f72e0a33d55887f929ff848684;p=xonotic%2Fxonotic-data.pk3dir.git Alternative fix: don't modify the player state if it's not owned by the client --- diff --git a/qcsrc/common/state.qc b/qcsrc/common/state.qc index eaa96892f..891461c6a 100644 --- a/qcsrc/common/state.qc +++ b/qcsrc/common/state.qc @@ -16,12 +16,12 @@ void PlayerState_detach(entity this) if (!ps) return; // initial connect PS(this) = NULL; + if (ps.m_client != this) return; // don't own state, spectator ps.m_switchweapon = WEP_Null; ps.m_weapon = WEP_Null; ps.m_switchingweapon = WEP_Null; ps.ps_push(ps, this); - - if (ps.m_client != this) return; // don't own state, spectator + FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; }); delete(ps); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index a37227d03..c212691db 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -218,8 +218,7 @@ void FixPlayermodel(entity player); void PutObserverInServer(entity this) { bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this); - if(IS_PLAYER(this)) // our own state - PlayerState_detach(this); + PlayerState_detach(this); if (IS_PLAYER(this) && this.health >= 1) { // despawn effect