MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetValue

Method GetValue

src/newgrf_config.cpp:164–173  ·  view source on GitHub ↗

* Get the value of the given user-changeable parameter. * @param info The grf parameter info to get the value for. * @return The value of this parameter. */

Source from the content-addressed store, hash-verified

162 * @return The value of this parameter.
163 */
164uint32_t GRFConfig::GetValue(const GRFParameterInfo &info) const
165{
166 /* If the parameter is not set then it must be 0. */
167 if (info.param_nr >= std::size(this->param)) return 0;
168
169 /* GB doesn't work correctly with nbits == 32, so handle that case here. */
170 if (info.num_bit == 32) return this->param[info.param_nr];
171
172 return GB(this->param[info.param_nr], info.first_bit, info.num_bit);
173}
174
175/**
176 * Set the value of the given user-changeable parameter.

Callers 6

DrawWidgetMethod · 0.45
OnClickMethod · 0.45
GetVariableMethod · 0.45
GetVariableMethod · 0.45
GetVariableMethod · 0.45
GetRegisterMethod · 0.45

Calls 2

GBFunction · 0.85
sizeFunction · 0.50

Tested by

no test coverage detected