static */
| 71 | } |
| 72 | |
| 73 | /* static */ SignID ScriptSign::BuildSign(TileIndex location, Text *name) |
| 74 | { |
| 75 | ScriptObjectRef counter(name); |
| 76 | |
| 77 | EnforceDeityOrCompanyModeValid(SignID::Invalid()); |
| 78 | EnforcePrecondition(SignID::Invalid(), ::IsValidTile(location)); |
| 79 | EnforcePrecondition(SignID::Invalid(), name != nullptr); |
| 80 | const std::string &text = name->GetDecodedText(); |
| 81 | EnforcePreconditionEncodedText(SignID::Invalid(), text); |
| 82 | EnforcePreconditionCustomError(SignID::Invalid(), ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG); |
| 83 | |
| 84 | if (!ScriptObject::Command<CMD_PLACE_SIGN>::Do(&ScriptInstance::DoCommandReturnSignID, location, text)) return SignID::Invalid(); |
| 85 | |
| 86 | /* In case of test-mode, we return SignID 0 */ |
| 87 | return SignID::Begin(); |
| 88 | } |
nothing calls this directly
no test coverage detected