]> icculus.org git repositories - btb/d2x.git/blob - main/cvar.h
set cvar values via formatted string. convenient macro for setint
[btb/d2x.git] / main / cvar.h
1 /* Console variables */
2
3 #ifndef _CVAR_H
4 #define _CVAR_H 1
5
6 #include "pstypes.h"
7 #include "cfile.h"
8
9
10 typedef struct cvar_s
11 {
12         char *name;
13         char *string;
14         bool archive;
15         float value;
16         int intval;
17         struct cvar_s *next;
18 } cvar_t;
19
20
21 /* Register a CVar with the name and string and optionally archive elements set */
22 void cvar_registervariable (cvar_t *cvar);
23
24 /* Set a CVar's value */
25 void cvar_set_cvar(cvar_t *cvar, char *value);
26 void cvar_set_cvarf(cvar_t *cvar, char *fmt, ...);
27 #define cvar_setint(cvar, x) cvar_set_cvarf((cvar), "%d", (x))
28
29 /* Equivalent to typing <var_name> <value> at the console */
30 void cvar_set(char *cvar_name, char *value);
31
32 /* Get the pointer to a cvar by name */
33 cvar_t *cvar_find(char *cvar_name);
34
35 /* Try to autocomplete a cvar name */
36 char *cvar_complete(char *text);
37
38 /* Get a CVar's value */
39 float cvar(char *cvar_name);
40
41 /* Write archive cvars to file */
42 void cvar_write(CFILE *file);
43
44
45 #endif /* _CVAR_H_ */