]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/replicate.qh
BOT AI: Sometimes bot is pushed so hard (by a jumppad or a shot) that ends up touchin...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / replicate.qh
index eae9a6e6f1389a531d5b5c09a35f241cce8ff11a..c7a42042deac253dc3172aeaf929a80ba2958b18 100644 (file)
@@ -1,11 +1,18 @@
 #pragma once
 
-#ifndef MENUQC
+#ifdef GAMEQC
 
+    /**
+     * Replicate a client cvar into a server field
+     *
+     * @param fld   The field to replicate into
+     * @param type  The field type
+     * @param cvar  The cvar name
+     */
        #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__))
        #define EVAL_REPLICATE(...) __VA_ARGS__
 
-       [[accumulate]] void ReplicateVars(entity this, string thisname, int i) {}
+       [[accumulate]] void ReplicateVars(entity this, entity store, string thisname, int i) {}
 
        #define REPLICATE_3(fld, type, var) REPLICATE_4(fld, type, var, )
        #define REPLICATE_4(fld, type, var, func) REPLICATE_##type(fld, var, func)
@@ -28,9 +35,9 @@
 
        #if defined(SVQC)
                #define REPLICATE_7(fld, type, var, func, create, destroy, after) \
-                       void ReplicateVars(entity this, string thisname, int i) \
+                       void ReplicateVars(entity this, entity store, string thisname, int i) \
                        { \
-                               type field = this.fld; \
+                               type field = store.fld; \
                                if (i < 0) { destroy } \
                                else \
                                { \
@@ -46,7 +53,7 @@
                                        } \
                                        if (current) { after } \
                                } \
-                               this.fld = field; \
+                               store.fld = field; \
                        }
        #elif defined(CSQC)
                // TODO