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

Method SetName

src/script/api/script_company.cpp:63–74  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

61}
62
63/* static */ bool ScriptCompany::SetName(Text *name)
64{
65 ScriptObjectRef counter(name);
66
67 EnforceCompanyModeValid(false);
68 EnforcePrecondition(false, name != nullptr);
69 const std::string &text = name->GetDecodedText();
70 EnforcePreconditionEncodedText(false, text);
71 EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_COMPANY_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
72
73 return ScriptObject::Command<CMD_RENAME_COMPANY>::Do(text);
74}
75
76/* static */ std::optional<std::string> ScriptCompany::GetName(ScriptCompany::CompanyID company)
77{

Callers

nothing calls this directly

Calls 2

Utf8StringLengthFunction · 0.85
GetDecodedTextMethod · 0.80

Tested by

no test coverage detected