Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
replicate.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EVAL_REPLICATE(...)
#define REPLICATE(...)
 Replicates a client cvar into a server field.
#define REPLICATE_3(fld, type, var)
#define REPLICATE_4(fld, type, var, func)
#define REPLICATE_7(fld, type, var, func, create, destroy, after)
#define REPLICATE_APPLYCHANGE(var, ApplyChange_code)
 Allows setting code that will be executed on cvar value changes.
#define REPLICATE_bool(fld, var, func)
#define REPLICATE_float(fld, var, func)
#define REPLICATE_INIT(type, name)
#define REPLICATE_int(fld, var, func)
#define REPLICATE_string(fld, var, func)
#define REPLICATE_vector(fld, var, func)

Functions

ACCUMULATE void ReplicateVars (entity this, entity store, string thisname, int i)
ACCUMULATE void ReplicateVars_ApplyChange (entity this, entity store, string thisname, int i)

Variables

const int REPLICATEVARS_CHECK = 0
const int REPLICATEVARS_DESTROY = 1
const int REPLICATEVARS_SEND_ALL = -1

Macro Definition Documentation

◆ EVAL_REPLICATE

#define EVAL_REPLICATE ( ...)
Value:
__VA_ARGS__

Definition at line 24 of file replicate.qh.

◆ REPLICATE

#define REPLICATE ( ...)
Value:
#define EVAL_REPLICATE(...)
Definition replicate.qh:24
#define REPLICATE(...)
Replicates a client cvar into a server field.
Definition replicate.qh:23
#define OVERLOAD(F,...)
Definition misc.qh:12

Replicates a client cvar into a server field.

Parameters
fldThe field to replicate into
typeThe field type
cvarname
fixup_func((entitythis, string original_value)) optional parameter

Definition at line 23 of file replicate.qh.

Referenced by REPLICATE(), and REPLICATE().

◆ REPLICATE_3

#define REPLICATE_3 ( fld,
type,
var )
Value:
REPLICATE_4(fld, type, var, )
#define REPLICATE_4(fld, type, var, func)
Definition replicate.qh:58

Definition at line 57 of file replicate.qh.

◆ REPLICATE_4

#define REPLICATE_4 ( fld,
type,
var,
func )
Value:
REPLICATE_##type(fld, var, func)

Definition at line 58 of file replicate.qh.

◆ REPLICATE_7

#define REPLICATE_7 ( fld,
type,
var,
func,
create,
destroy,
after )
Value:
void ReplicateVars(entity this, entity store, string thisname, int i) \
{ \
type field = store.fld; \
if (i < 0) { destroy } \
else \
{ \
string it = func(argv(i + 1)); \
bool current = thisname == var; \
if (i > 0) \
{ \
if (current) { create } \
} \
else \
{ \
stuffcmd(this, strcat("cl_cmd sendcvar ", var, "\n")); \
} \
if (current) { after } \
} \
store.fld = field; \
}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string argv(float n)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void ReplicateVars(bool would_destroy)
Definition all.qh:895

Definition at line 77 of file replicate.qh.

77 #define REPLICATE_7(fld, type, var, func, create, destroy, after) \
78 void ReplicateVars(entity this, entity store, string thisname, int i) \
79 { \
80 type field = store.fld; \
81 if (i < 0) { destroy } \
82 else \
83 { \
84 string it = func(argv(i + 1)); \
85 bool current = thisname == var; \
86 if (i > 0) \
87 { \
88 if (current) { create } \
89 } \
90 else \
91 { \
92 stuffcmd(this, strcat("cl_cmd sendcvar ", var, "\n")); \
93 } \
94 if (current) { after } \
95 } \
96 store.fld = field; \
97 }

◆ REPLICATE_APPLYCHANGE

#define REPLICATE_APPLYCHANGE ( var,
ApplyChange_code )
Value:
void ReplicateVars_ApplyChange(entity this, entity store, string thisname, int i) \
{ if (thisname == var) { ApplyChange_code } }
ACCUMULATE void ReplicateVars_ApplyChange(entity this, entity store, string thisname, int i)
Definition replicate.qh:28

Allows setting code that will be executed on cvar value changes.

Parameters
cvarname
ApplyChange_codecode meant to be run on cvar value changes

Definition at line 36 of file replicate.qh.

36 #define REPLICATE_APPLYCHANGE(var, ApplyChange_code) \
37 void ReplicateVars_ApplyChange(entity this, entity store, string thisname, int i) \
38 { if (thisname == var) { ApplyChange_code } }

◆ REPLICATE_bool

#define REPLICATE_bool ( fld,
var,
func )
Value:
REPLICATE_7(fld, bool, var, func, { field = boolean(stoi(it)); }, , )
#define boolean(value)
Definition bool.qh:9
#define stoi(s)
Definition int.qh:4
#define REPLICATE_7(fld, type, var, func, create, destroy, after)
Definition replicate.qh:77

Definition at line 74 of file replicate.qh.

◆ REPLICATE_float

#define REPLICATE_float ( fld,
var,
func )
Value:
REPLICATE_7(fld, float, var, func, { field = stof(it); }, , )
float stof(string val,...)

Definition at line 73 of file replicate.qh.

◆ REPLICATE_INIT

#define REPLICATE_INIT ( type,
name )
Value:
type name
string name
Definition menu.qh:30

Definition at line 7 of file replicate.qh.

◆ REPLICATE_int

#define REPLICATE_int ( fld,
var,
func )
Value:
REPLICATE_7(fld, int, var, func, { field = stoi(it); }, , )

Definition at line 75 of file replicate.qh.

◆ REPLICATE_string

#define REPLICATE_string ( fld,
var,
func )
Value:
REPLICATE_7(fld, string, var, , \
{ strcpy(field, it); }, \
{ strfree(field); }, \
{ \
/* also initialize to the default value of func when requesting cvars */ \
string s = func(this, strcat(field)); \
if (s != field) \
{ \
strcpy(field, s); \
} \
})
#define strfree(this)
Definition string.qh:59
#define strcpy(this, s)
Definition string.qh:52

Definition at line 60 of file replicate.qh.

60 #define REPLICATE_string(fld, var, func) \
61 REPLICATE_7(fld, string, var, , \
62 { strcpy(field, it); }, \
63 { strfree(field); }, \
64 { \
65 /* also initialize to the default value of func when requesting cvars */ \
66 string s = func(this, strcat(field)); \
67 if (s != field) \
68 { \
69 strcpy(field, s); \
70 } \
71 })

◆ REPLICATE_vector

#define REPLICATE_vector ( fld,
var,
func )
Value:
REPLICATE_7(fld, vector, var, func, { field = stov(it); }, , )
vector stov(string s)
vector
Definition self.qh:92

Definition at line 72 of file replicate.qh.

Function Documentation

◆ ReplicateVars()

ACCUMULATE void ReplicateVars ( entity this,
entity store,
string thisname,
int i )

Definition at line 27 of file replicate.qh.

27{}

References ACCUMULATE, and entity().

◆ ReplicateVars_ApplyChange()

ACCUMULATE void ReplicateVars_ApplyChange ( entity this,
entity store,
string thisname,
int i )

Definition at line 28 of file replicate.qh.

28{}

References ACCUMULATE, and entity().

Referenced by GetCvars().

Variable Documentation

◆ REPLICATEVARS_CHECK

const int REPLICATEVARS_CHECK = 0

Definition at line 5 of file replicate.qh.

Referenced by CSQC_UpdateView().

◆ REPLICATEVARS_DESTROY

const int REPLICATEVARS_DESTROY = 1

Definition at line 6 of file replicate.qh.

Referenced by Shutdown().

◆ REPLICATEVARS_SEND_ALL

const int REPLICATEVARS_SEND_ALL = -1

Definition at line 4 of file replicate.qh.