OpenTTD Source: BoolSettingDesc Struct Reference

OpenTTD Source 13.1

Public Member Functions
BoolSettingDesc Struct Reference

Boolean setting. More...

`#include <settings_internal.h>`

Inheritance diagram for BoolSettingDesc:

## Public Member Functions
| BoolSettingDesc (SaveLoad save, SettingFlag flags, bool startup, bool def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback)
bool | IsBoolSetting () const override
| Check whether this setting is a boolean type setting. More...
size_t | ParseValue (const char *str) const override
| Convert a string representation (external) of an integer-like setting to an integer. More...
void | FormatValue (char *buf, const char *last, const void *object) const override
| Format the value of the setting associated with this object. More...
Public Member Functions inherited from IntSettingDesc
| IntSettingDesc (SaveLoad save, SettingFlag flags, bool startup, int32 def, int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback)
bool | IsIntSetting () const override
| Check whether this setting is an integer type setting. More...
void | ChangeValue (const void *object, int32 newvalue) const
| Handle changing a value. More...
void | MakeValueValidAndWrite (const void *object, int32 value) const
| Make the value valid and then write it to the setting. 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...
int32 | Read (const void *object) const
| Read the integer from the the actual setting. More...
Public Member Functions inherited from SettingDesc
| SettingDesc (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 | 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...

## Additional Inherited Members
Public Types inherited from IntSettingDesc
typedef bool | PreChangeCheck(int32 &value)
| A check to be performed before the setting gets changed. More...
typedef void | PostChangeCallback(int32 value)
| A callback to denote that a setting has been changed. More...
Data Fields inherited from IntSettingDesc
int32 | def
| default value given when none is present
int32 | min
| minimum values
uint32 | max
| maximum values
int32 | interval
| the interval to use between settings in the 'settings' window. If interval is '0' the interval is dynamically determined
StringID | str
| (translated) string with descriptive text; gui and console
StringID | str_help
| (Translated) string with help text; gui only.
StringID | str_val
| (Translated) first string describing the value.
SettingCategory | cat
| assigned categories of the setting
PreChangeCheck * | pre_check
| Callback to check for the validity of the setting.
PostChangeCallback * | post_callback
| Callback when the setting has been changed.
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).

## Detailed Description

Boolean setting.

Definition at line 193 of file settings_internal.h.

## Member Function Documentation

## ◆ FormatValue()

void BoolSettingDesc::FormatValue | ( | char * | buf,
|  | const char * | last,
|  | const void * | object
| ) |  | const
| overridevirtual

Format the value of the setting associated with this object.

Parameters

  buf | The before of the buffer to format into.
  last | The end of the buffer to format into.
  object | The object the setting is in.

Reimplemented from IntSettingDesc.

Definition at line 690 of file settings.cpp.

References IntSettingDesc::Read(), and strecpy().

## ◆ IsBoolSetting()

bool BoolSettingDesc::IsBoolSetting | ( |  | ) | const
| inlineoverridevirtual

Check whether this setting is a boolean type setting.

Returns
  True when the underlying type is an integer.

Reimplemented from IntSettingDesc.

Definition at line 201 of file settings_internal.h.

## ◆ ParseValue()

size_t BoolSettingDesc::ParseValue | ( | const char * | str | ) | const
| overridevirtual

Convert a string representation (external) of an integer-like setting to an integer.

Parameters

  str | Input string that will be parsed based on the type of desc.

Returns
  The value from the parse string, or the default value of the setting.

Reimplemented from IntSettingDesc.

Definition at line 422 of file settings.cpp.

References _settings_error_list, IntSettingDesc::def, SettingDesc::GetName(), ErrorMessageData::SetDParamStr(), and IntSettingDesc::str.

The documentation for this struct was generated from the following files:

- src/settings_internal.h
- src/settings.cpp