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:
Peter Nelson
2025-03-04 01:00:40 +00:00
committed by Peter Nelson
parent 2a05a845df
commit b55af05626
34 changed files with 126 additions and 114 deletions

View File

@@ -32,11 +32,11 @@
EnforceDeityMode(LEAGUE_TABLE_INVALID);
EnforcePrecondition(LEAGUE_TABLE_INVALID, title != nullptr);
std::string encoded_title = title->GetEncodedText();
EncodedString encoded_title = title->GetEncodedText();
EnforcePreconditionEncodedText(LEAGUE_TABLE_INVALID, encoded_title);
std::string encoded_header = (header != nullptr ? header->GetEncodedText() : std::string{});
std::string encoded_footer = (footer != nullptr ? footer->GetEncodedText() : std::string{});
EncodedString encoded_header = (header != nullptr ? header->GetEncodedText() : EncodedString{});
EncodedString encoded_footer = (footer != nullptr ? footer->GetEncodedText() : EncodedString{});
if (!ScriptObject::Command<CMD_CREATE_LEAGUE_TABLE>::Do(&ScriptInstance::DoCommandReturnLeagueTableID, encoded_title, encoded_header, encoded_footer)) return LEAGUE_TABLE_INVALID;
@@ -62,11 +62,11 @@
::CompanyID c = ScriptCompany::FromScriptCompanyID(company);
EnforcePrecondition(LEAGUE_TABLE_ELEMENT_INVALID, text != nullptr);
std::string encoded_text = text->GetEncodedText();
EncodedString encoded_text = text->GetEncodedText();
EnforcePreconditionEncodedText(LEAGUE_TABLE_ELEMENT_INVALID, encoded_text);
EnforcePrecondition(LEAGUE_TABLE_ELEMENT_INVALID, score != nullptr);
std::string encoded_score = score->GetEncodedText();
EncodedString encoded_score = score->GetEncodedText();
EnforcePreconditionEncodedText(LEAGUE_TABLE_ELEMENT_INVALID, encoded_score);
EnforcePrecondition(LEAGUE_TABLE_ELEMENT_INVALID, IsValidLink(Link((::LinkType)link_type, link_target)));
@@ -88,7 +88,7 @@
::CompanyID c = ScriptCompany::FromScriptCompanyID(company);
EnforcePrecondition(false, text != nullptr);
std::string encoded_text = text->GetEncodedText();
EncodedString encoded_text = text->GetEncodedText();
EnforcePreconditionEncodedText(false, encoded_text);
EnforcePrecondition(false, IsValidLink(Link((::LinkType)link_type, link_target)));
@@ -104,7 +104,7 @@
EnforcePrecondition(false, IsValidLeagueTableElement(element));
EnforcePrecondition(false, score != nullptr);
std::string encoded_score = score->GetEncodedText();
EncodedString encoded_score = score->GetEncodedText();
EnforcePreconditionEncodedText(false, encoded_score);
return ScriptObject::Command<CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE>::Do(element, rating, encoded_score);