OpenTTD Source
20241120-master-g6d3adc6169
|
List/array settings. More...
#include <settings_internal.h>
Public Member Functions | |
ListSettingDesc (const SaveLoad &save, SettingFlag flags, bool startup, const char *def) | |
std::string | FormatValue (const void *object) const override |
Convert an integer-array (intlist) to a string representation. More... | |
void | ParseValue (const IniItem *item, void *object) const override |
Parse/read the value from the Ini item into the setting associated with this object. More... | |
bool | IsSameValue (const IniItem *item, void *object) const override |
Check whether the value in the Ini item is the same as is saved in this setting in the object. More... | |
bool | IsDefaultValue (void *object) const override |
Check whether the value is the same as the default value. More... | |
void | ResetToDefault (void *object) const override |
Reset the setting to its default value. | |
Public Member Functions inherited from SettingDesc | |
SettingDesc (const SaveLoad &save, SettingFlag flags, bool startup) | |
bool | IsEditable (bool do_command=false) const |
Check whether the setting is editable in the current gamemode. More... | |
SettingType | GetType () const |
Return the type of the setting. More... | |
constexpr const std::string & | GetName () const |
Get the name of this setting. More... | |
virtual bool | IsIntSetting () const |
Check whether this setting is an integer type setting. More... | |
virtual bool | IsStringSetting () const |
Check whether this setting is an string type setting. More... | |
const struct IntSettingDesc * | AsIntSetting () const |
Get the setting description of this setting as an integer setting. More... | |
const struct StringSettingDesc * | AsStringSetting () const |
Get the setting description of this setting as a string setting. More... | |
Data Fields | |
const char * | def |
default value given when none is present | |
Data Fields inherited from SettingDesc | |
SettingFlag | flags |
Handles how a setting would show up in the GUI (text/currency, etc.). | |
bool | startup |
Setting has to be loaded directly at startup?. | |
SaveLoad | save |
Internal structure (going to savegame, parts to config). | |
List/array settings.
Definition at line 360 of file settings_internal.h.
|
overridevirtual |
Convert an integer-array (intlist) to a string representation.
Each value is separated by a comma or a space character
buf | output buffer where the string-representation will be stored |
last | last item to write to in the output buffer |
array | pointer to the integer-arrays that is read from |
nelems | the number of elements the array holds. |
type | the type of elements the array holds (eg INT8, UINT16, etc.) |
Implements SettingDesc.
Definition at line 322 of file settings.cpp.
References GetVariableAddress(), and SettingDesc::save.
|
overridevirtual |
Check whether the value is the same as the default value.
object | The object the setting is in. |
Implements SettingDesc.
Definition at line 803 of file settings.cpp.
|
overridevirtual |
Check whether the value in the Ini item is the same as is saved in this setting in the object.
It might be that determining whether the value is the same is way more expensive than just writing the value. In those cases this function may unconditionally return false even though the value might be the same as in the Ini item.
item | The Ini item with the content of this setting. |
object | The object the setting is in. |
Implements SettingDesc.
Definition at line 797 of file settings.cpp.
|
overridevirtual |
Parse/read the value from the Ini item into the setting associated with this object.
item | The Ini item with the content of this setting. |
object | The object the setting is in. |
Implements SettingDesc.
Definition at line 668 of file settings.cpp.
References _settings_error_list, SaveLoad::conv, def, SettingDesc::GetName(), GetVariableAddress(), GetVarMemType(), SaveLoad::length, LoadIntList(), SettingDesc::save, ErrorMessageData::SetDParamStr(), and IniItem::value.