mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 17:02:37 +01:00
Codechange: Pass encoded script strings as EncodedString.
This removes the ambiguity of having std::strings that may or may not be encoded.
This commit is contained in:
committed by
Peter Nelson
parent
2a05a845df
commit
b55af05626
@@ -153,7 +153,7 @@ SQInteger ScriptText::_set(HSQUIRRELVM vm)
|
||||
return this->_SetParam(k, vm);
|
||||
}
|
||||
|
||||
std::string ScriptText::GetEncodedText()
|
||||
EncodedString ScriptText::GetEncodedText()
|
||||
{
|
||||
ScriptTextList seen_texts;
|
||||
ParamList params;
|
||||
@@ -163,7 +163,7 @@ std::string ScriptText::GetEncodedText()
|
||||
this->_FillParamList(params, seen_texts);
|
||||
this->_GetEncodedText(output, param_count, params, true);
|
||||
if (param_count > SCRIPT_TEXT_MAX_PARAMETERS) throw Script_FatalError(fmt::format("{}: Too many parameters", GetGameStringName(this->string)));
|
||||
return result;
|
||||
return ::EncodedString{std::move(result)};
|
||||
}
|
||||
|
||||
void ScriptText::_FillParamList(ParamList ¶ms, ScriptTextList &seen_texts)
|
||||
@@ -298,5 +298,5 @@ void ScriptText::_GetEncodedText(std::back_insert_iterator<std::string> &output,
|
||||
|
||||
const std::string Text::GetDecodedText()
|
||||
{
|
||||
return ::GetString(STR_JUST_RAW_STRING, this->GetEncodedText());
|
||||
return this->GetEncodedText().GetDecodedString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user