From: terencehill Date: Mon, 25 Mar 2024 14:07:30 +0000 (+0100) Subject: Implement REPLICATE_vector for the automatic cvar networking system X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=09557f9132f5aa52fae2eb83117e608177198fc7;p=xonotic%2Fxonotic-data.pk3dir.git Implement REPLICATE_vector for the automatic cvar networking system --- diff --git a/qcsrc/lib/replicate.qh b/qcsrc/lib/replicate.qh index 675d743c1..65428c9cd 100644 --- a/qcsrc/lib/replicate.qh +++ b/qcsrc/lib/replicate.qh @@ -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); }, )