]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 86acdc154064ac6d0bc80258e7fca234d369740c..7b4c54f9f6b16271fa584a917e72ddcff139b7fc 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 0180fea784793f921036cf52bc4a2a91a1ad0aa1..3a9f084bcf7cfd8188a48534ce3c9bd0f4432619 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 fc3530744c2a693cc5cb20100e568c78ab517845..2a1168eae017978fe7f56d72004bda716fc49344 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);
 }