mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-15 18:49:10 +00:00
Add: GetString that returns std::string instead of filling a passed buffer
This commit is contained in:
@@ -285,6 +285,18 @@ char *GetString(char *buffr, StringID string, const char *last)
|
||||
return GetStringWithArgs(buffr, string, &_global_string_params, last);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the given StringID into a std::string with all the associated
|
||||
* DParam lookups and formatting.
|
||||
* @param string The unique identifier of the translatable string.
|
||||
* @return The std::string of the translated string.
|
||||
*/
|
||||
std::string GetString(StringID string)
|
||||
{
|
||||
char buffer[DRAW_STRING_BUFFER];
|
||||
GetString(buffer, string, lastof(buffer));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to "bind" a C string to a OpenTTD dparam slot.
|
||||
|
Reference in New Issue
Block a user