mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-01-21 23:50:58 +00:00
port over int_val from nuq. much better for integer cvars
This commit is contained in:
parent
60a1c3b857
commit
9a4e650790
2 changed files with 4 additions and 0 deletions
|
@ -39,6 +39,7 @@ typedef struct cvar_s
|
|||
int flags;
|
||||
char *description; // for "help" command
|
||||
float value;
|
||||
int int_val;
|
||||
struct cvar_s *next;
|
||||
} cvar_t;
|
||||
|
||||
|
|
|
@ -199,6 +199,7 @@ void Cvar_Set (cvar_t *var, char *value)
|
|||
var->string = malloc (strlen(value)+1);
|
||||
strcpy (var->string, value);
|
||||
var->value = atof (var->string);
|
||||
var->int_val = atoi (var->string);
|
||||
|
||||
Cvar_Info(var);
|
||||
}
|
||||
|
@ -219,6 +220,7 @@ void Cvar_SetROM (cvar_t *var, char *value)
|
|||
var->string = malloc (strlen(value)+1);
|
||||
strcpy (var->string, value);
|
||||
var->value = atof (var->string);
|
||||
var->int_val = atoi (var->string);
|
||||
|
||||
Cvar_Info(var);
|
||||
}
|
||||
|
@ -464,6 +466,7 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description)
|
|||
v->flags = cvarflags;
|
||||
v->description = description;
|
||||
v->value = atof (v->string);
|
||||
v->int_val = atoi (v->string);
|
||||
return v;
|
||||
}
|
||||
// Cvar does exist, so we update the flags and return.
|
||||
|
|
Loading…
Reference in a new issue