X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fstate.qc;h=891461c6a4dd24f92886c1c89522af11e67f2093;hb=6f8580dc5709394d3764cba7212119356908cfb7;hp=0ffe55eb4fa50ba77a3c0c22ddb5c2b4defa2812;hpb=42a9e3d7ece2c716e5cd6899e90841acb7fb891b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/state.qc b/qcsrc/common/state.qc index 0ffe55eb4..891461c6a 100644 --- a/qcsrc/common/state.qc +++ b/qcsrc/common/state.qc @@ -15,9 +15,15 @@ void PlayerState_detach(entity this) PlayerState ps = PS(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); + FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; }); - remove(ps); + delete(ps); Inventory_delete(this); } @@ -39,13 +45,12 @@ void ClientState_attach(entity this) GetCvars(this, 0); // get other cvars from player - if (IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); } - // TODO: fold all of these into ClientState DecodeLevelParms(this); PlayerScore_Attach(this); + PlayerStats_PlayerBasic_CheckUpdate(this); ClientData_Attach(this); accuracy_init(this); entcs_attach(this); @@ -67,7 +72,7 @@ void PlayerScore_Detach(entity this); void ClientState_detach(entity this) { - remove(CS(this)); + delete(CS(this)); this._cs = NULL; GetCvars(this, -1); // free cvars