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

Method SetName

src/script/api/script_town.cpp:43–56  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

41}
42
43/* static */ bool ScriptTown::SetName(TownID town_id, Text *name)
44{
45 ScriptObjectRef counter(name);
46
47 EnforceDeityMode(false);
48 EnforcePrecondition(false, IsValidTown(town_id));
49 std::string text;
50 if (name != nullptr) {
51 text = name->GetDecodedText();
52 EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_TOWN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
53 }
54
55 return ScriptObject::Command<CMD_RENAME_TOWN>::Do(town_id, text);
56}
57
58/* static */ bool ScriptTown::SetText(TownID town_id, Text *text)
59{

Callers

nothing calls this directly

Calls 2

Utf8StringLengthFunction · 0.85
GetDecodedTextMethod · 0.80

Tested by

no test coverage detected