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.
 GRFParameterInfo (GRFParameterInfo &info)
 Create a new GRFParameterInfo object that is a deep copy of an existing parameter info object.
 ~GRFParameterInfo ()
 Cleanup all parameter info.
uint32 GetValue (struct GRFConfig *config) const
 Get the value of this user-changeable parameter from the given config.
void SetValue (struct GRFConfig *config, uint32 value)
 Set the value of this user-changeable parameter in the given config.

Data Fields

struct GRFText * name
 The name of this parameter.
struct GRFText * 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, struct
GRFText *, 8 > 
value_names
 Names for each value.

Detailed Description

Information about one grf parameter.

Definition at line 113 of file newgrf_config.h.


Constructor & Destructor Documentation

GRFParameterInfo::GRFParameterInfo ( uint  nr  ) 

Create a new empty GRFParameterInfo object.

Parameters:
nr The newgrf parameter that is changed.

Definition at line 174 of file newgrf_config.cpp.

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 191 of file newgrf_config.cpp.

References DuplicateGRFText(), SmallVector< T, S >::Get(), SmallMap< T, U, S >::Insert(), SmallVector< T, S >::Length(), and value_names.

GRFParameterInfo::~GRFParameterInfo (  ) 

Cleanup all parameter info.

Definition at line 209 of file newgrf_config.cpp.

References CleanUpGRFText(), desc, SmallVector< T, S >::Get(), SmallVector< T, S >::Length(), name, and value_names.


Member Function Documentation

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 224 of file newgrf_config.cpp.

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

Referenced by NewGRFParametersWindow::DrawWidget(), and NewGRFParametersWindow::OnClick().

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 236 of file newgrf_config.cpp.

References num_bit, GRFConfig::num_params, GRFConfig::param, param_nr, SB(), and SetWindowClassesDirty().

Referenced by NewGRFParametersWindow::OnClick(), and NewGRFParametersWindow::OnQueryTextFinished().


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

Generated on Fri Feb 4 20:54:32 2011 for OpenTTD by  doxygen 1.6.1