summaryrefslogtreecommitdiff
path: root/src/script/api/script_group.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-08 21:48:05 +0000
committerrubidium <rubidium@openttd.org>2012-01-08 21:48:05 +0000
commit4479f90843d3597268f889a3955f3c5289b92e0a (patch)
tree969e79bea4a892f189791f593751fa0ff463240e /src/script/api/script_group.cpp
parentab38e3227dbbefab952530c4ddf5408605187fcb (diff)
downloadopenttd-4479f90843d3597268f889a3955f3c5289b92e0a.tar.xz
(svn r23777) -Codechange: refactor allocating memory and fetching strings into a single function for scripts
Diffstat (limited to 'src/script/api/script_group.cpp')
-rw-r--r--src/script/api/script_group.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/script/api/script_group.cpp b/src/script/api/script_group.cpp
index 3dfc50a09..b04ece2fa 100644
--- a/src/script/api/script_group.cpp
+++ b/src/script/api/script_group.cpp
@@ -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)