Attach entcs to the client state
authorMario <mario@smbclan.net>
Fri, 26 Oct 2018 03:03:51 +0000 (13:03 +1000)
committerMario <mario@smbclan.net>
Fri, 26 Oct 2018 03:03:51 +0000 (13:03 +1000)
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh
qcsrc/common/state.qc

index 86acdc1..7b4c54f 100644 (file)
@@ -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
index 0180fea..3a9f084 100644 (file)
@@ -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
 
index fc35307..2a1168e 100644 (file)
@@ -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);
 }