diff options
author | rubidium42 <rubidium@openttd.org> | 2021-04-27 20:58:17 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-06 21:45:36 +0200 |
commit | 6bca9e090dc6637fd7b6ed6a5a37d65f151849e9 (patch) | |
tree | 062edb9db599f8e3244f6ed4acf3ad85f39912ae /src/strings.cpp | |
parent | f313a539a54efe09850bcab0680d281e3cc54444 (diff) | |
download | openttd-6bca9e090dc6637fd7b6ed6a5a37d65f151849e9.tar.xz |
Codechange: add SetDParamStr that accepts std::string&
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 048971459..2b6dbc3ef 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -297,6 +297,17 @@ void SetDParamStr(uint n, const char *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. */ |