cvars can use callbacks now. Use Cvar_ForceSet inside to undo the change.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2188 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
7d89845224
commit
b12ead1a7d
|
@ -695,7 +695,11 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
|
||||||
if (latch)
|
if (latch)
|
||||||
{
|
{
|
||||||
if (strcmp(latch, value))
|
if (strcmp(latch, value))
|
||||||
|
{
|
||||||
var->modified++; //only modified if it changed.
|
var->modified++; //only modified if it changed.
|
||||||
|
if (var->callback)
|
||||||
|
var->callback(var, latch);
|
||||||
|
}
|
||||||
|
|
||||||
Z_Free (latch); // free the old value string
|
Z_Free (latch); // free the old value string
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,12 +67,16 @@ typedef struct cvar_s
|
||||||
//free style :)
|
//free style :)
|
||||||
char *name2;
|
char *name2;
|
||||||
|
|
||||||
|
void (*callback) (struct cvar_s *var, char *oldvalue);
|
||||||
|
|
||||||
char *defaultstr; //default
|
char *defaultstr; //default
|
||||||
qbyte restriction;
|
qbyte restriction;
|
||||||
} cvar_t;
|
} cvar_t;
|
||||||
|
|
||||||
#define FCVAR(ConsoleName,ConsoleName2,Value,Flags) {ConsoleName, Value, NULL, Flags, 0, 0, 0, ConsoleName2}
|
#define FCVARC(ConsoleName,ConsoleName2,Value,Flags,Callback) {ConsoleName, Value, NULL, Flags, 0, 0, 0, ConsoleName2, Callback}
|
||||||
|
#define FCVAR(ConsoleName,ConsoleName2,Value,Flags) FCVARC(ConsoleName, ConsoleName2, Value, Flags, NULL)
|
||||||
#define SCVARF(ConsoleName,Value, Flags) FCVAR(ConsoleName, NULL, Value, Flags)
|
#define SCVARF(ConsoleName,Value, Flags) FCVAR(ConsoleName, NULL, Value, Flags)
|
||||||
|
#define SCVARC(ConsoleName,Value,Callback) FCVARC(ConsoleName, NULL, Value, 0, Callback)
|
||||||
#define SCVAR(ConsoleName,Value) FCVAR(ConsoleName, NULL, Value, 0)
|
#define SCVAR(ConsoleName,Value) FCVAR(ConsoleName, NULL, Value, 0)
|
||||||
|
|
||||||
typedef struct cvar_group_s
|
typedef struct cvar_group_s
|
||||||
|
|
Loading…
Reference in New Issue