Codechange: add SetDParamStr that accepts std::string&

This commit is contained in:
rubidium42
2021-04-27 20:58:17 +02:00
committed by rubidium42
parent f313a539a5
commit 6bca9e090d
11 changed files with 30 additions and 18 deletions

View File

@@ -296,6 +296,17 @@ void SetDParamStr(uint n, const char *str)
SetDParam(n, (uint64)(size_t)str);
}
/**
* This function is used to "bind" the C string of a std::string to a OpenTTD dparam slot.
* The caller has to ensure that the std::string reference remains valid while the string is shown.
* @param n slot of the string
* @param str string to bind
*/
void SetDParamStr(uint n, const std::string &str)
{
SetDParamStr(n, str.c_str());
}
/**
* Shift the string parameters in the global string parameter array by \a amount positions, making room at the beginning.
* @param amount Number of positions to shift.