(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 ab38e3227d
commit 4479f90843
14 changed files with 27 additions and 60 deletions

View File

@@ -55,12 +55,8 @@
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return NULL;
static const int len = 64;
char *company_name = MallocT<char>(len);
::SetDParam(0, company);
::GetString(company_name, STR_COMPANY_NAME, &company_name[len - 1]);
return company_name;
return GetString(STR_COMPANY_NAME);
}
/* static */ bool ScriptCompany::SetPresidentName(Text *name)