Adding New Config Options - GrognardsFromHell/TemplePlus GitHub Wiki
The config system (TemplePlus.ini) currently supports the following data types:
- string
- double
- int
- bool
To get a new config option, simply add your config field to config.h (don't forget to set a default value) with the right data type. Let's say it's int myField. Then you can access it from anywhere by including config.h and accessing config.myField, since config is a global variable.
To make the config system actually read and write your new config variable from and to TemplePlus.ini, go into config.cpp to the array of configuration options:
static ConfigSetting configSettings[] = {
CONF_BOOL(skipIntro),
CONF_BOOL(skipLegal),
...
};
Add your configuration option to the end of that list using one of the provided macros:
CONF_BOOLfor fields of typeboolCONF_INTfor fields of typeintCONF_STRINGfor fields of typestringCONF_DOUBLEfor fields of typedouble
So using our example from above: CONF_INT(myField)