|
@@ -55,30 +55,26 @@
|
|
|
EnforcePrecondition(false, name != NULL);
|
|
|
const char *text = name->GetEncodedText();
|
|
|
EnforcePrecondition(false, !::StrEmpty(text));
|
|
|
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_GROUP_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
|
|
|
|
|
|
return ScriptObject::DoCommand(0, group_id, 0, CMD_RENAME_GROUP, text);
|
|
|
}
|
|
|
|
|
|
/* static */ char *ScriptGroup::GetName(GroupID group_id)
|
|
|
{
|
|
|
if (!IsValidGroup(group_id)) return NULL;
|
|
|
|
|
|
static const int len = 64;
|
|
|
char *group_name = MallocT<char>(len);
|
|
|
|
|
|
::SetDParam(0, group_id);
|
|
|
::GetString(group_name, STR_GROUP_NAME, &group_name[len - 1]);
|
|
|
return group_name;
|
|
|
return GetString(STR_GROUP_NAME);
|
|
|
}
|
|
|
|
|
|
/* static */ bool ScriptGroup::EnableAutoReplaceProtection(GroupID group_id, bool enable)
|
|
|
{
|
|
|
EnforcePrecondition(false, IsValidGroup(group_id));
|
|
|
|
|
|
return ScriptObject::DoCommand(0, group_id, enable ? 1 : 0, CMD_SET_GROUP_REPLACE_PROTECTION);
|
|
|
}
|
|
|
|
|
|
/* static */ bool ScriptGroup::GetAutoReplaceProtection(GroupID group_id)
|
|
|
{
|
|
|
if (!IsValidGroup(group_id)) return false;
|