(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

@@ -36,12 +36,8 @@
{
if (!IsValidEngine(engine_id)) return NULL;
static const int len = 64;
char *engine_name = MallocT<char>(len);
::SetDParam(0, engine_id);
::GetString(engine_name, STR_ENGINE_NAME, &engine_name[len - 1]);
return engine_name;
return GetString(STR_ENGINE_NAME);
}
/* static */ CargoID ScriptEngine::GetCargoType(EngineID engine_id)