(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

@@ -27,12 +27,8 @@
{
if (!IsValidBaseStation(station_id)) return NULL;
static const int len = 64;
char *name = MallocT<char>(len);
::SetDParam(0, station_id);
::GetString(name, ::Station::IsValidID(station_id) ? STR_STATION_NAME : STR_WAYPOINT_NAME, &name[len - 1]);
return name;
return GetString(::Station::IsValidID(station_id) ? STR_STATION_NAME : STR_WAYPOINT_NAME);
}
/* static */ bool ScriptBaseStation::SetName(StationID station_id, Text *name)