(svn r23777) -Codechange: refactor allocating memory and fetching strings into a single function for scripts

This commit is contained in:
rubidium
2012-01-08 21:48:05 +00:00
parent 02af3fe2fa
commit 4ad23bbf98
14 changed files with 27 additions and 60 deletions

View File

@@ -64,12 +64,8 @@
{
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)