1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-29 09:29:10 +00:00

Codechange: Add AppendStringWithArgsInPlace() function.

This commit is contained in:
2025-02-21 23:38:34 +00:00
committed by Peter Nelson
parent 04a16a6b68
commit 0428f8c667
2 changed files with 8 additions and 0 deletions

View File

@@ -458,6 +458,13 @@ void AppendStringInPlace(std::string &result, StringID string)
GetStringWithArgs(builder, string, _global_string_params);
}
void AppendStringWithArgsInPlace(std::string &result, StringID string, std::span<StringParameter> params)
{
StringParameters tmp_params{params};
StringBuilder builder(result);
GetStringWithArgs(builder, string, tmp_params);
}
/**
* Get a parsed string with most special stringcodes replaced by the string parameters.
* @param string The ID of the string to parse.

View File

@@ -63,6 +63,7 @@ std::string GetStringWithArgs(StringID string, std::span<StringParameter> args);
std::string GetString(StringID string);
const char *GetStringPtr(StringID string);
void AppendStringInPlace(std::string &result, StringID string);
void AppendStringWithArgsInPlace(std::string &result, StringID string, std::span<StringParameter> params);
uint ConvertKmhishSpeedToDisplaySpeed(uint speed, VehicleType type);
uint ConvertDisplaySpeedToKmhishSpeed(uint speed, VehicleType type);