]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
entcs: upgrade to linked entity, don't throw away
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 28 Aug 2016 08:12:10 +0000 (18:12 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 28 Aug 2016 08:12:10 +0000 (18:12 +1000)
qcsrc/common/ent_cs.qc

index 5b48ef668d0b443141c82435e863fb60c14996ac..24440b61e1f96556c0ded72c8a7b0d1ef2d4cc0c 100644 (file)
        {
                int n = ReadByte();
                entity e = entcs_receiver(n);
+               #define X(e) { \
+                       setthink(e, entcs_think); \
+                       entcs_receiver(n, e); \
+               }
                if (e == NULL)
                {
-                       if (this)
+                       if (!this)
                        {
-                               e = this;
+                               // initial = temp
+                               e = new_pure(entcs_receiver);
+                               X(e);
                        }
                        else
                        {
-                               e = new(entcs_receiver);
-                               make_pure(e);
+                               // initial = linked
+                               e = this;
+                               X(e);
                        }
-                       e.sv_entnum = n;
-                       setthink(e, entcs_think);
-                       entcs_receiver(n, e);
                }
-               else if (this && e != this)
+               else if (e != this && this)
                {
-                       this.classname = "entcs_gc";
-                       this.sv_entnum = n;
+                       // upgrade to linked
+                       delete(e);
+                       e = this;
+                       X(e);
                }
-               this = e;
-               InterpolateOrigin_Undo(this);
-               this.sv_entnum = n;
+               #undef X
+               InterpolateOrigin_Undo(e);
+               e.sv_entnum = n;
                int sf = ReadShort();
-               this.has_sv_origin = false;
-               this.m_entcs_private = boolean(sf & BIT(0));
+               e.has_sv_origin = false;
+               e.m_entcs_private = boolean(sf & BIT(0));
                int i = 0;
                #define X(public, fld, sv, cl) { \
                        if (sf & BIT(i)) { \
                }
                ENTCS_NETPROPS(X);
        #undef X
-               this.iflags |= IFLAG_ORIGIN;
-               InterpolateOrigin_Note(this);
-               getthink(this)(this);
+               e.iflags |= IFLAG_ORIGIN;
+               InterpolateOrigin_Note(e);
+               getthink(e)(e);
                return true;
        }