]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/net.qh
Shorten a few names
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / net.qh
index fe2952e2c4025c3d5f84854627824cc3f4ab3d6f..2994ea164bb1d58a9f9bee7e2a8a71ed9ad52d99 100644 (file)
@@ -44,13 +44,13 @@ REGISTRY(TempEntities, BITS(8) - 80)
 REGISTER_REGISTRY(TempEntities)
 REGISTRY_SORT(TempEntities)
 REGISTRY_CHECK(TempEntities)
-STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 + i); }
+STATIC_INIT(TempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 + i); }
 
 
 
 #ifdef CSQC
        #define REGISTER_NET_LINKED(id) \
-               [[accumulate]] NET_HANDLE(id, bool isnew) \
+               ACCUMULATE NET_HANDLE(id, bool isnew) \
                { \
                        this = __self; \
                        this.sourceLoc = __FILE__ ":" STR(__LINE__); \
@@ -76,7 +76,7 @@ REGISTRY(LinkedEntities, BITS(8) - 1)
 REGISTER_REGISTRY(LinkedEntities)
 REGISTRY_SORT(LinkedEntities)
 REGISTRY_CHECK(LinkedEntities)
-STATIC_INIT(RegisterLinkedEntities_renumber) { FOREACH(LinkedEntities, true, it.m_id = 1 + i); }
+STATIC_INIT(LinkedEntities_renumber) { FOREACH(LinkedEntities, true, it.m_id = 1 + i); }
 
 
 
@@ -107,7 +107,6 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
 #ifdef SVQC
        const int MSG_ENTITY = 5;
 
-       .int Version;  // deprecated, use SendFlags
        .int SendFlags;
 
        IntrusiveList g_uncustomizables;
@@ -188,13 +187,13 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
        const int MSG_C2S = 0;
 
        #define Net_Accept(classname) \
-               MACRO_BEGIN \
-                       if (!this)    this = new(classname); \
-               MACRO_END
+               MACRO_BEGIN \
+                       if (!this) this = new(classname); \
+               MACRO_END
        #define Net_Reject() \
-               MACRO_BEGIN \
-                       if (this)     delete(this); \
-               MACRO_END
+               MACRO_BEGIN \
+                       if (this) delete(this); \
+               MACRO_END
 
        string g_buf;
 
@@ -202,23 +201,20 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
        {
                if (g_buf == "") return;
                localcmd("\ncmd c2s \"", strreplace("$", "$$", g_buf), "\"\n");
-               strunzone(g_buf);
-               g_buf = string_null;
+               strfree(g_buf);
        }
 #endif
 
 #if defined(CSQC)
        #define WriteHeader(to, id) \
-               MACRO_BEGIN { \
-                       WriteByte(to, NET_##id.m_id); \
-               } MACRO_END
+               WriteByte(to, NET_##id.m_id)
 #elif defined(SVQC)
        #define WriteHeader(to, id) \
-               MACRO_BEGIN \
+               MACRO_BEGIN \
                        if (NET_##id##_istemp) WriteByte(to, SVC_TEMPENTITY); \
                        WriteByte(to, NET_##id.m_id); \
                        bool _net_valid = false; serialize_marker(to, _net_valid); \
-               MACRO_END
+               MACRO_END
 #endif
 
 // serialization: new style
@@ -301,8 +297,7 @@ MACRO_END
                string s = string_null;
                yenc_single(b, s);
                string tmp = strcat(g_buf, s);
-               if (g_buf) strunzone(g_buf);
-               g_buf = strzone(tmp);
+               strcpy(g_buf, tmp);
        }
        void WriteShort(int to, int b)
        {
@@ -389,9 +384,9 @@ MACRO_END
                        WriteInt24_t(dst, val.z);
                }
 
-        #define WriteFloat(to, f) WriteCoord(to, f)
-               #define WriteVector(to, v) MACRO_BEGIN { WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); } MACRO_END
-        #define WriteVector2D(to, v) MACRO_BEGIN { WriteFloat(to, v.x); WriteFloat(to, v.y); } MACRO_END
+               #define WriteFloat(to, f) WriteCoord(to, f)
+               #define WriteVector(to, v) MACRO_BEGIN WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); MACRO_END
+               #define WriteVector2D(to, v) MACRO_BEGIN WriteFloat(to, v.x); WriteFloat(to, v.y); MACRO_END
 
                // this will use the value:
                //   128
@@ -416,7 +411,7 @@ MACRO_END
                }
 
                // allow writing to also pass through to spectators (like so spectators see the same centerprints as players for example)
-               #define WRITESPECTATABLE_MSG_ONE(to, statement) MACRO_BEGIN \
+               #define WRITESPECTATABLE_MSG_ONE(to, statement) MACRO_BEGIN \
                        entity prev = msg_entity; \
                        entity dst = to; \
                        FOREACH_CLIENT(IS_REAL_CLIENT(it), { \
@@ -427,6 +422,6 @@ MACRO_END
                                } \
                        }); \
                        msg_entity = prev; \
-               MACRO_END
+               MACRO_END
        #endif
 #endif