= !ConfigValueContainer = == Description == The !ConfigValueContainer is a class that manages [wiki:howto/ConfigValue config-values]. A config-value is a member-variable of a class that can be changed through the [wiki:howto/ConfigFile config-file]. The config-file is usually {{{orxonox.ini}}}. A !ConfigValueContainer is basically just what it's name says: a container. You can think about it as a buffer between the config-file (which is hard to parse) and a config-value (which will be assigned to lots of class instances). Every config-value has it's own !ConfigValueContainer. The container is stored in a map inside the [wiki:Identifier] of the corresponding class. This way it's possible to iterate through all ConfigValueContainers of a class. A !ConfigValueContainer for a specific config-value is either created as soon as a class declares the config-value or when a new config-file with a new value gets loaded. == Usage == The usage of the !ConfigValueContainer is usually hidden from the programmer because several macros (see [wiki:ConfigValueIncludes]) or other classes (see [wiki:ConfigFileManager]) do all the work. == Creating a new config-value == A new config-value can be defined by using the '''SetConfigValue('''''varname, defvalue''''')''' macro where ''varname'' is a member variable of a class and ''defvalue'' the default value that will be used if no other value is configured. The macro-call must take place within the '''setConfigValues()''' function of this class. Calling setConfigValues() of an object causes all ConfigValueContainers of it's class to assign the stored values to the variables of the object. The values are initially read from the config-file but can be changed during the game by using a [wiki:ConsoleCommand] in the [wiki:Shell] ("'''config''' ''classname varname value''"). It's possible to change variables only temporary without saving the new value in the config-file ("'''tconfig''' ''classname varname value''"). See [wiki:ConfigValueIncludes] for more information about how to create and modify different types of config-values.