-
Notifications
You must be signed in to change notification settings - Fork 22
Adding New Config Options
shartte edited this page Apr 8, 2015
·
1 revision
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_BOOL
for fields of typebool
-
CONF_INT
for fields of typeint
-
CONF_STRING
for fields of typestring
-
CONF_DOUBLE
for fields of typedouble
So using our example from above: CONF_INT(myField)