]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/net.qh
Unsafe: allow field casting
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / net.qh
index 47d6af7186144f1dfc41a157ffa7867c3358096a..4e09d4b01043363a619153154f90dd08baf5ba6d 100644 (file)
@@ -41,7 +41,7 @@ STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id
        #define REGISTER_NET_LINKED(id) \
                [[accumulate]] NET_HANDLE(id, bool isnew) \
                { \
-                       this = self; \
+                       this = __self; \
                        this.sourceLoc = __FILE__ ":" STR(__LINE__); \
                        if (!this) isnew = true; \
                } \
@@ -97,11 +97,6 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
 
        .int Version;  // deprecated, use SendFlags
        .int SendFlags;
-       .bool(entity to, int sendflags) SendEntity;
-       /** return false to remove from the client */
-       .bool(entity this, entity to, int sendflags) SendEntity3;
-
-       bool SendEntity_self(entity to, int sendflags) { SELFPARAM(); return this.SendEntity3(this, to, sendflags); }
 
        void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
        {
@@ -115,8 +110,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                        setsize(e, mi, ma);
                }
 
-               e.SendEntity = SendEntity_self;
-               e.SendEntity3 = sendfunc;
+               setSendEntity(e, sendfunc);
                e.SendFlags = 0xFFFFFF;
 
                if (!docull) e.effects |= EF_NODEPTHTEST;
@@ -124,29 +118,28 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                if (dt)
                {
                        e.nextthink = time + dt;
-                       e.think = SUB_Remove_self;
+                       setthink(e, SUB_Remove);
                }
        }
 
        void Net_UnlinkEntity(entity e)
        {
-               e.SendEntity = func_null;
+               setSendEntity(e, func_null);
        }
 
-       .void() uncustomizeentityforclient;
+       .void(entity this) uncustomizeentityforclient;
        .float uncustomizeentityforclient_set;
 
-       void SetCustomizer(entity e, float() customizer, void() uncustomizer)
+       void SetCustomizer(entity e, bool(entity this) customizer, void(entity this) uncustomizer)
        {
-               e.customizeentityforclient = customizer;
+               setcefc(e, customizer);
                e.uncustomizeentityforclient = uncustomizer;
                e.uncustomizeentityforclient_set = !!uncustomizer;
        }
 
        void UncustomizeEntitiesRun()
        {
-           SELFPARAM();
-               FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITH(entity, self, it, it.uncustomizeentityforclient()));
+               FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, it.uncustomizeentityforclient(it));
        }
 
        STRING_ITERATOR(g_buf, string_null, 0);