From f0b43aed4f20e1034b2f7538d8c7252b29bd67a0 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 26 Oct 2018 13:03:51 +1000 Subject: [PATCH] Attach entcs to the client state --- qcsrc/common/ent_cs.qc | 12 ++++++------ qcsrc/common/ent_cs.qh | 2 +- qcsrc/common/state.qc | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 86acdc154..7b4c54f9f 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -164,23 +164,23 @@ ENTCS_PROP(FRAGS, true, frags, ENTCS_SET_NORMAL, void entcs_attach(entity player) { - entity e = player.entcs = new(entcs_sender); + entity e = CS(player).entcs = new(entcs_sender); e.owner = player; setthink(e, entcs_think); e.nextthink = time; Net_LinkEntity(e, false, 0, entcs_send); if (!IS_REAL_CLIENT(player)) return; FOREACH_CLIENT(true, { - assert(it.entcs); - _entcs_send(it.entcs, msg_entity = player, BITS(23), MSG_ONE); + assert(CS(it).entcs); + _entcs_send(CS(it).entcs, msg_entity = player, BITS(23), MSG_ONE); }); } void entcs_detach(entity player) { - if (!player.entcs) return; - delete(player.entcs); - player.entcs = NULL; + if (!CS(player).entcs) return; + delete(CS(player).entcs); + CS(player).entcs = NULL; } #endif diff --git a/qcsrc/common/ent_cs.qh b/qcsrc/common/ent_cs.qh index 0180fea78..3a9f084bc 100644 --- a/qcsrc/common/ent_cs.qh +++ b/qcsrc/common/ent_cs.qh @@ -43,7 +43,7 @@ REGISTER_NET_TEMP(CLIENT_ENTCS) .int m_forceupdate; /** Force an origin update, for player sounds */ - #define entcs_force_origin(e) ((e).entcs.m_forceupdate = BIT(2)) + #define entcs_force_origin(e) (CS(e).entcs.m_forceupdate = BIT(2)) #endif diff --git a/qcsrc/common/state.qc b/qcsrc/common/state.qc index fc3530744..2a1168eae 100644 --- a/qcsrc/common/state.qc +++ b/qcsrc/common/state.qc @@ -68,12 +68,11 @@ void ClientState_detach(entity this) PlayerScore_Detach(this); // what ^they^ said W_HitPlotClose(this); ClientData_Detach(this); + entcs_detach(this); delete(CS(this)); this._cs = NULL; - bot_clientdisconnect(this); anticheat_report_to_eventlog(this); - entcs_detach(this); } -- 2.39.2