consvar_t: add optional description field

This commit is contained in:
James R 2023-08-25 17:09:29 -07:00
parent 88cb0dda22
commit f1e4aa5cd4
2 changed files with 8 additions and 1 deletions

View file

@ -144,6 +144,7 @@ struct consvar_t //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NULL
INT32 flags; // flags see cvflags_t above
CV_PossibleValue_t *PossibleValue; // table of possible values
void (*func)(void); // called on change, if CV_CALL set
const char *description;
INT32 value; // for INT32 and fixed_t
const char *string; // value in string
char *zstring; // Either NULL or same as string.
@ -204,7 +205,7 @@ struct CVarList;
#define CVAR_INIT consvar_t
#else
#define CVAR_INIT( ... ) \
{ __VA_ARGS__, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
{ __VA_ARGS__, NULL, 0, NULL, NULL, {0, {NULL}}, 0U, (char)0, NULL }
#endif
extern CV_PossibleValue_t CV_OnOff[];

View file

@ -86,6 +86,12 @@ struct consvar_t::Builder
return builder;
}
Builder& description(const char* description)
{
var_.description = description;
return *this;
}
Builder& save()
{
var_.flags |= CV_SAVE;