mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add version of GetString() that takes parameters directly.
This allows parameters to be passed to GetString() bypassing the global parameter system.pull/13480/head
parent
be00fd4447
commit
ccd3d3a547
|
@ -122,6 +122,19 @@ auto MakeParameters(Args &&... args)
|
||||||
return std::array<StringParameter, sizeof...(args)>({std::forward<StringParameter>(args)...});
|
return std::array<StringParameter, sizeof...(args)>({std::forward<StringParameter>(args)...});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a parsed string with most special stringcodes replaced by the string parameters.
|
||||||
|
* @param string String ID to format.
|
||||||
|
* @param args The parameters to set.
|
||||||
|
* @return The parsed string.
|
||||||
|
*/
|
||||||
|
template <typename... Args>
|
||||||
|
std::string GetString(StringID string, Args &&... args)
|
||||||
|
{
|
||||||
|
auto params = MakeParameters(std::forward<Args &&>(args)...);
|
||||||
|
return GetStringWithArgs(string, params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A searcher for missing glyphs.
|
* A searcher for missing glyphs.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue