Use StringBuilder for GetString/GetStringWithArgs, as per upstream
Update dependent code as required
This commit is contained in:
@@ -896,13 +896,13 @@ void StopTextRefStackUsage()
|
||||
/**
|
||||
* FormatString for NewGRF specific "magic" string control codes
|
||||
* @param scc the string control code that has been read
|
||||
* @param buff the buffer we're writing to
|
||||
* @param buffer the buffer we're writing to
|
||||
* @param str the string that we need to write
|
||||
* @param parameters the OpenTTD string formatting parameters
|
||||
* @param modify_parameters When true, modify the OpenTTD string formatting parameters.
|
||||
* @return the string control code to "execute" now
|
||||
*/
|
||||
uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const char **str, StringParameters ¶meters, bool modify_parameters)
|
||||
uint RemapNewGRFStringControlCode(uint scc, std::string *buffer, const char **str, StringParameters ¶meters, bool modify_parameters)
|
||||
{
|
||||
auto too_many_newgrf_params = [&]() {
|
||||
const char *buffer = *str;
|
||||
@@ -1011,7 +1011,7 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
|
||||
|
||||
case SCC_NEWGRF_ROTATE_TOP_4_WORDS: _newgrf_textrefstack.RotateTop4Words(); break;
|
||||
case SCC_NEWGRF_PUSH_WORD: _newgrf_textrefstack.PushWord(Utf8Consume(str)); break;
|
||||
case SCC_NEWGRF_UNPRINT: *buff = std::max(*buff - Utf8Consume(str), buf_start); break;
|
||||
case SCC_NEWGRF_UNPRINT: if (buffer != nullptr) buffer->resize(buffer->size() - std::min<size_t>(buffer->size(), Utf8Consume(str))); break;
|
||||
|
||||
case SCC_NEWGRF_PRINT_WORD_CARGO_LONG:
|
||||
case SCC_NEWGRF_PRINT_WORD_CARGO_SHORT:
|
||||
|
Reference in New Issue
Block a user