diff options
author | rubidium <rubidium@openttd.org> | 2012-01-08 21:48:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2012-01-08 21:48:05 +0000 |
commit | 4479f90843d3597268f889a3955f3c5289b92e0a (patch) | |
tree | 969e79bea4a892f189791f593751fa0ff463240e /src/script/api/script_event_types.cpp | |
parent | ab38e3227dbbefab952530c4ddf5408605187fcb (diff) | |
download | openttd-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_event_types.cpp')
-rw-r--r-- | src/script/api/script_event_types.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/script/api/script_event_types.cpp b/src/script/api/script_event_types.cpp index 382c6f0ba..0e1683440 100644 --- a/src/script/api/script_event_types.cpp +++ b/src/script/api/script_event_types.cpp @@ -28,12 +28,9 @@ bool ScriptEventEnginePreview::IsEngineValid() const char *ScriptEventEnginePreview::GetName() { if (!this->IsEngineValid()) return NULL; - static const int len = 64; - char *engine_name = MallocT<char>(len); ::SetDParam(0, this->engine); - ::GetString(engine_name, STR_ENGINE_NAME, &engine_name[len - 1]); - return engine_name; + return GetString(STR_ENGINE_NAME); } CargoID ScriptEventEnginePreview::GetCargoType() |