port over int_val from nuq. much better for integer cvars

This commit is contained in:
Bill Currie 2000-09-26 03:17:09 +00:00
parent 60a1c3b857
commit 9a4e650790
2 changed files with 4 additions and 0 deletions

View file

@ -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;

View file

@ -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.