summaryrefslogtreecommitdiff
path: root/src/newgrf_text.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-13 19:15:26 +0000
committerrubidium <rubidium@openttd.org>2010-11-13 19:15:26 +0000
commitfc75b00992dbf6f86a39aca1a2cda4e6378b6bba (patch)
tree2b9c10b294d39bc0bd667ac26696d44a49ec93e2 /src/newgrf_text.cpp
parent034eb834cc277048e296bf1297f56e1667ab9881 (diff)
downloadopenttd-fc75b00992dbf6f86a39aca1a2cda4e6378b6bba.tar.xz
(svn r21178) -Codechange: pass the language_id to TranslateTTDPatchCodes as well
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r--src/newgrf_text.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index ae48aa3eb..167e27b9a 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -196,7 +196,14 @@ static GRFTextEntry _grf_text[(1 << TABSIZE) * 3];
static byte _currentLangID = GRFLX_ENGLISH; ///< by default, english is used.
-char *TranslateTTDPatchCodes(uint32 grfid, const char *str)
+/**
+ * Translate TTDPatch string codes into something OpenTTD can handle (better).
+ * @param grfid The (NewGRF) ID associated with this string
+ * @param language_id The (NewGRF) language ID associated with this string.
+ * @param str The string to translate.
+ * @return The translated string.
+ */
+char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, const char *str)
{
char *tmp = MallocT<char>(strlen(str) * 10 + 1); // Allocate space to allow for expansion
char *d = tmp;
@@ -380,7 +387,7 @@ void AddGRFTextToList(GRFText **list, GRFText *text_to_add)
*/
void AddGRFTextToList(struct GRFText **list, byte langid, uint32 grfid, const char *text_to_add)
{
- char *translatedtext = TranslateTTDPatchCodes(grfid, text_to_add);
+ char *translatedtext = TranslateTTDPatchCodes(grfid, langid, text_to_add);
GRFText *newtext = GRFText::New(langid, translatedtext);
free(translatedtext);
@@ -449,7 +456,7 @@ StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, bool ne
/* Too many strings allocated, return empty */
if (id == lengthof(_grf_text)) return STR_EMPTY;
- translatedtext = TranslateTTDPatchCodes(grfid, text_to_add);
+ translatedtext = TranslateTTDPatchCodes(grfid, langid_to_add, text_to_add);
GRFText *newtext = GRFText::New(langid_to_add, translatedtext);