OpenTTD Source: GRFParameterInfo Struct Reference

OpenTTD Source 1.11.0-RC1

Public Member Functions | Data Fields
GRFParameterInfo Struct Reference

Information about one grf parameter. More...

`#include <newgrf_config.h>`

## Public Member Functions
| GRFParameterInfo (uint nr)
| Create a new empty GRFParameterInfo object. More...
| GRFParameterInfo (GRFParameterInfo &info)
| Create a new GRFParameterInfo object that is a deep copy of an existing parameter info object. More...
uint32 | GetValue (struct GRFConfig *config) const
| Get the value of this user-changeable parameter from the given config. More...
void | SetValue (struct GRFConfig *config, uint32 value)
| Set the value of this user-changeable parameter in the given config. More...
void | Finalize ()
| Finalize Action 14 info after file scan is finished.

## Data Fields
GRFTextList | name
| The name of this parameter.
GRFTextList | desc
| The description of this parameter.
GRFParameterType | type
| The type of this parameter.
uint32 | min_value
| The minimal value this parameter can have.
uint32 | max_value
| The maximal value of this parameter.
uint32 | def_value
| Default value of this parameter.
byte | param_nr
| GRF parameter to store content in.
byte | first_bit
| First bit to use in the GRF parameter.
byte | num_bit
| Number of bits to use for this parameter.
SmallMap< uint32, GRFTextList > | value_names
| Names for each value.
bool | complete_labels
| True if all values have a label.

## Detailed Description

Information about one grf parameter.

Definition at line 131 of file newgrf_config.h.

## Constructor & Destructor Documentation

## ◆ GRFParameterInfo() [1/2]

GRFParameterInfo::GRFParameterInfo | ( | uint | nr | ) |

Create a new empty GRFParameterInfo object.

Parameters

  nr | The newgrf parameter that is changed.

Definition at line 204 of file newgrf_config.cpp.

## ◆ GRFParameterInfo() [2/2]

GRFParameterInfo::GRFParameterInfo | ( | GRFParameterInfo & | info | ) |

Create a new GRFParameterInfo object that is a deep copy of an existing parameter info object.

Parameters

  info | The GRFParameterInfo object to make a copy of.

Definition at line 223 of file newgrf_config.cpp.

## Member Function Documentation

## ◆ GetValue()

uint32 GRFParameterInfo::GetValue | ( | struct GRFConfig * | config | ) | const

Get the value of this user-changeable parameter from the given config.

Parameters

  config | The GRFConfig to get the value from.

Returns
  The value of this parameter.

Definition at line 243 of file newgrf_config.cpp.

References GB(), num_bit, GRFConfig::param, and param_nr.

## ◆ SetValue()

void GRFParameterInfo::SetValue | ( | struct GRFConfig * | config,
|  | uint32 | value
| ) |  |

Set the value of this user-changeable parameter in the given config.

Parameters

  config | The GRFConfig to set the value in.
  value | The new value.

Definition at line 255 of file newgrf_config.cpp.

References num_bit, GRFConfig::num_params, GRFConfig::param, param_nr, SB(), SetWindowDirty(), WC_GAME_OPTIONS, and WN_GAME_OPTIONS_NEWGRF_STATE.

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

- src/newgrf_config.h
- src/newgrf_config.cpp