Codechange: allow string temporaries in a StringParameter

This commit is contained in:
Rubidium
2023-06-27 16:59:44 +02:00
committed by rubidium42
parent 78f5d58dc6
commit 3e488465f8
3 changed files with 29 additions and 5 deletions

View File

@@ -363,6 +363,18 @@ void SetDParamStr(size_t n, const std::string &str)
_global_string_params.SetParam(n, str);
}
/**
* This function is used to "bind" the std::string to a OpenTTD dparam slot.
* Contrary to the other \c SetDParamStr functions, this moves the string into
* the parameter slot.
* @param n slot of the string
* @param str string to bind
*/
void SetDParamStr(size_t n, std::string &&str)
{
_global_string_params.SetParam(n, std::move(str));
}
/**
* Format a number into a string.
* @param builder the string builder to write to