From 9a4e650790cdc4d4264b409e4a64c05e288bfd61 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 26 Sep 2000 03:17:09 +0000 Subject: [PATCH] port over int_val from nuq. much better for integer cvars --- include/cvar.h | 1 + source/cvar.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/cvar.h b/include/cvar.h index a34c5d6..472a76b 100644 --- a/include/cvar.h +++ b/include/cvar.h @@ -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; diff --git a/source/cvar.c b/source/cvar.c index 8cc7ba8..1f0d93c 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -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.