]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement REPLICATE_vector for the automatic cvar networking system
authorterencehill <piuntn@gmail.com>
Mon, 25 Mar 2024 14:07:30 +0000 (15:07 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 25 Mar 2024 14:07:30 +0000 (15:07 +0100)
qcsrc/lib/replicate.qh

index 675d743c1892826940c6a8cb6b5b5924629289ce..65428c9cd985160f70971cf288f79a3a101d9429 100644 (file)
@@ -74,6 +74,7 @@ const int REPLICATEVARS_DESTROY = 1; // destroy data associated with cvars (shut
                                strcpy(field, s); \
                        } \
                })
+               #define REPLICATE_vector(fld, var, func) REPLICATE_7(fld, vector, var, func, { field = stov(it); },          , )
                #define REPLICATE_float(fld, var, func) REPLICATE_7(fld, float, var, func,  { field = stof(it); },          , )
                #define REPLICATE_bool(fld, var, func) REPLICATE_7(fld, bool, var, func,   { field = boolean(stoi(it)); }, , )
                #define REPLICATE_int(fld, var, func) REPLICATE_7(fld, int, var, func,    { field = stoi(it); },          , )
@@ -100,6 +101,7 @@ const int REPLICATEVARS_DESTROY = 1; // destroy data associated with cvars (shut
                                store.fld = field; \
                        }
        #elif defined(CSQC)
+               #define REPLICATE_vector(fld, var, func) REPLICATE_7(fld, vector, var, func, (fld != stov(cvar_string(var))), { fld = stov(cvar_string(var)); }, )
                #define REPLICATE_string(fld, var, func) REPLICATE_7(fld, float, var, func, (fld != cvar_string(var)), { strcpy(fld, cvar_string(var)); }, { strfree(fld); })
                #define REPLICATE_float(fld, var, func) REPLICATE_7(fld, float, var, func, (fld != cvar(var)), { fld = cvar(var); }, )
                #define REPLICATE_bool(fld, var, func) REPLICATE_7(fld, bool, var, func, (fld != cvar(var)), { fld = cvar(var); }, )