about summary refs log tree commit diff
path: root/src/game/client/components
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-02-10 12:07:00 +0100
committeroy <Tom_Adams@web.de>2011-02-10 12:07:00 +0100
commit0c119ba99bdf78c3c0a0a9562abe7e139e97e530 (patch)
tree6f3da29157aeba9f2426df932027e58ea4c7a60f /src/game/client/components
parent3f05289328dfaeb67a344de0b553e31cbb11ea36 (diff)
downloadzcatch-0c119ba99bdf78c3c0a0a9562abe7e139e97e530.tar.gz
zcatch-0c119ba99bdf78c3c0a0a9562abe7e139e97e530.zip
fixed possible problem with localisations if the linereader flushes its memory between reading the origin and the replacement string
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/menus_settings.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index a1779796..9accd6af 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -690,6 +690,7 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<
 		return;
 	}
 	
+	char aOrigin[128];
 	CLineReader LineReader;
 	LineReader.Init(File);
 	char *pLine;
@@ -697,7 +698,8 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<
 	{
 		if(!str_length(pLine) || pLine[0] == '#') // skip empty lines and comments
 			continue;
-			
+		
+		str_copy(aOrigin, pLine, sizeof(aOrigin));
 		char *pReplacement = LineReader.Get();
 		if(!pReplacement)
 		{
@@ -708,13 +710,13 @@ void LoadLanguageIndexfile(IStorage *pStorage, IConsole *pConsole, sorted_array<
 		if(pReplacement[0] != '=' || pReplacement[1] != '=' || pReplacement[2] != ' ')
 		{
 			char aBuf[128];
-			str_format(aBuf, sizeof(aBuf), "malform replacement for index '%s'", pLine);
+			str_format(aBuf, sizeof(aBuf), "malform replacement for index '%s'", aOrigin);
 			pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", aBuf);
 			continue;
 		}
 		
 		char aFileName[128];
-		str_format(aFileName, sizeof(aFileName), "languages/%s.txt", pLine);
+		str_format(aFileName, sizeof(aFileName), "languages/%s.txt", aOrigin);
 		pLanguages->add(CLanguage(pReplacement+3, aFileName));
 	}
 	io_close(File);