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

Function GetDriverParamInt

src/driver.cpp:79–86  ·  view source on GitHub ↗

* Get an integer parameter the list of parameters. * @param parm The parameters. * @param name The parameter name we're looking for. * @param def The default value if the parameter doesn't exist. * @return The parameter value. */

Source from the content-addressed store, hash-verified

77 * @return The parameter value.
78 */
79int GetDriverParamInt(const StringList &parm, std::string_view name, int def)
80{
81 auto p = GetDriverParam(parm, name);
82 if (!p.has_value()) return def;
83 auto value = ParseInteger<int>(*p);
84 if (value.has_value()) return *value;
85 UserError("Invalid value for driver parameter {}: {}", name, *p);
86}
87
88/**
89 * Find the requested driver and return its class.

Callers 9

StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85
StartMethod · 0.85

Calls 1

GetDriverParamFunction · 0.85

Tested by

no test coverage detected