MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetPresidentName

Method SetPresidentName

src/script/api/script_company.cpp:84–95  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

82}
83
84/* static */ bool ScriptCompany::SetPresidentName(Text *name)
85{
86 ScriptObjectRef counter(name);
87
88 EnforceCompanyModeValid(false);
89 EnforcePrecondition(false, name != nullptr);
90 const std::string &text = name->GetDecodedText();
91 EnforcePreconditionEncodedText(false, text);
92 EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_PRESIDENT_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
93
94 return ScriptObject::Command<CMD_RENAME_PRESIDENT>::Do(text);
95}
96
97/* static */ std::optional<std::string> ScriptCompany::GetPresidentName(ScriptCompany::CompanyID company)
98{

Callers

nothing calls this directly

Calls 2

Utf8StringLengthFunction · 0.85
GetDecodedTextMethod · 0.80

Tested by

no test coverage detected