OpenTTD Source: ScriptConfigItem Struct Reference

OpenTTD Source 15.3

Public Member Functions | Data Fields
ScriptConfigItem Struct Reference

Info about a single Script setting. More...

`#include <script_config.hpp>`

## Public Member Functions
std::string | GetString (int value) const
| Get string to display this setting in the configuration interface.
TextColour | GetColour () const
| Get text colour to display this setting in the configuration interface.

## Data Fields
std::string | name
| The name of the configuration setting.
std::string | description
| The description of the configuration setting.
int | min_value = 0
| The minimal value this configuration setting can have.
int | max_value = 1
| The maximal value this configuration setting can have.
int | default_value = 0
| The default value of this configuration setting.
int | step_size = 1
| The step size in the gui.
ScriptConfigFlags | flags {}
| Flags for the configuration setting.
LabelMapping | labels
| Text labels for the integer values.
bool | complete_labels = false
| True if all values have a label.

## Detailed Description

Info about a single Script setting.

Definition at line 33 of file script_config.hpp.

## Member Function Documentation

## ◆ GetColour()

TextColour ScriptConfigItem::GetColour | ( |  | ) | const

Get text colour to display this setting in the configuration interface.

Returns
  Text colour to display this setting.

Definition at line 222 of file script_config.cpp.

References description.

Referenced by GSConfigWindow::DrawWidget(), and ScriptSettingsWindow::DrawWidget().

## ◆ GetString()

std::string ScriptConfigItem::GetString | ( | int | value | ) | const

Get string to display this setting in the configuration interface.

Parameters

  value | Current value.

Returns
  String to display.

Definition at line 210 of file script_config.cpp.

References description, and GetString().

Referenced by GSConfigWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), and GetString().

## Field Documentation

## ◆ complete_labels

bool ScriptConfigItem::complete_labels = false

True if all values have a label.

Definition at line 42 of file script_config.hpp.

Referenced by ScriptInfo::AddLabels(), GSConfigWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GSConfigWindow::OnClick(), and ScriptSettingsWindow::OnClick().

## ◆ default_value

int ScriptConfigItem::default_value = 0

The default value of this configuration setting.

Definition at line 38 of file script_config.hpp.

Referenced by ScriptInfo::AddSetting(), and ScriptInfo::GetSettingDefaultValue().

## ◆ description

std::string ScriptConfigItem::description

The description of the configuration setting.

Definition at line 35 of file script_config.hpp.

Referenced by ScriptInfo::AddSetting(), GetColour(), and GetString().

## ◆ flags

ScriptConfigFlags ScriptConfigItem::flags {}

Flags for the configuration setting.

Definition at line 40 of file script_config.hpp.

Referenced by ScriptInfo::AddSetting(), GSConfigWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GSConfigWindow::OnClick(), ScriptSettingsWindow::OnClick(), and ScriptConfig::ResetEditableSettings().

## ◆ labels

LabelMapping ScriptConfigItem::labels

Text labels for the integer values.

Definition at line 41 of file script_config.hpp.

Referenced by ScriptInfo::AddLabels(), GSConfigWindow::OnClick(), and ScriptSettingsWindow::OnClick().

## ◆ max_value

int ScriptConfigItem::max_value = 1

The maximal value this configuration setting can have.

Definition at line 37 of file script_config.hpp.

Referenced by ScriptInfo::AddLabels(), ScriptInfo::AddSetting(), GSConfigWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GSConfigWindow::OnClick(), ScriptSettingsWindow::OnClick(), and ScriptConfig::SetSetting().

## ◆ min_value

int ScriptConfigItem::min_value = 0

The minimal value this configuration setting can have.

Definition at line 36 of file script_config.hpp.

Referenced by ScriptInfo::AddLabels(), ScriptInfo::AddSetting(), GSConfigWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GSConfigWindow::OnClick(), ScriptSettingsWindow::OnClick(), and ScriptConfig::SetSetting().

## ◆ name

std::string ScriptConfigItem::name

The name of the configuration setting.

Definition at line 34 of file script_config.hpp.

Referenced by ScriptInfo::AddSetting(), GSConfigWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GSConfigWindow::OnClick(), and ScriptSettingsWindow::OnClick().

## ◆ step_size

int ScriptConfigItem::step_size = 1

The step size in the gui.

Definition at line 39 of file script_config.hpp.

Referenced by ScriptInfo::AddSetting(), GSConfigWindow::OnClick(), and ScriptSettingsWindow::OnClick().

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

- src/script/script_config.hpp
- src/script/script_config.cpp