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

Method SetName

src/script/api/script_sign.cpp:37–49  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

35}
36
37/* static */ bool ScriptSign::SetName(SignID sign_id, Text *name)
38{
39 ScriptObjectRef counter(name);
40
41 EnforceDeityOrCompanyModeValid(false);
42 EnforcePrecondition(false, IsValidSign(sign_id));
43 EnforcePrecondition(false, name != nullptr);
44 const std::string &text = name->GetDecodedText();
45 EnforcePreconditionEncodedText(false, text);
46 EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
47
48 return ScriptObject::Command<CMD_RENAME_SIGN>::Do(sign_id, text);
49}
50
51/* static */ std::optional<std::string> ScriptSign::GetName(SignID sign_id)
52{

Callers

nothing calls this directly

Calls 2

Utf8StringLengthFunction · 0.85
GetDecodedTextMethod · 0.80

Tested by

no test coverage detected