diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | f35ed4bbc2b05f1b83476b60948d64375f77f1b4 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/newgrf_text.cpp | |
parent | a332d10fd938f345fff18e5f4a662a58f692f734 (diff) | |
download | openttd-f35ed4bbc2b05f1b83476b60948d64375f77f1b4.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r-- | src/newgrf_text.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index e859f6e6c..af1dc688a 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -20,6 +20,7 @@ #include "newgrf.h" #include "newgrf_text.h" #include "table/control_codes.h" +#include "helpers.hpp" #define GRFTAB 28 #define TABSIZE 11 @@ -157,7 +158,8 @@ static byte _currentLangID = GRFLX_ENGLISH; //by default, english is used. char *TranslateTTDPatchCodes(const char *str) { - char *tmp = malloc(strlen(str) * 10 + 1); /* Allocate space to allow for expansion */ + char *tmp; + MallocT(&tmp, strlen(str) * 10 + 1); /* Allocate space to allow for expansion */ char *d = tmp; bool unicode = false; WChar c; @@ -253,7 +255,8 @@ char *TranslateTTDPatchCodes(const char *str) } *d = '\0'; - return realloc(tmp, strlen(tmp) + 1); + ReallocT(&tmp, strlen(tmp) + 1); + return tmp; } @@ -295,7 +298,7 @@ StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, bool ne translatedtext = TranslateTTDPatchCodes(text_to_add); - newtext = malloc(sizeof(*newtext) + strlen(translatedtext) + 1); + newtext = (GRFText*)malloc(sizeof(*newtext) + strlen(translatedtext) + 1); newtext->next = NULL; newtext->langid = langid_to_add; strcpy(newtext->text, translatedtext); |