diff options
| author | oy <Tom_Adams@web.de> | 2011-02-10 12:07:00 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-10 12:07:00 +0100 |
| commit | 0c119ba99bdf78c3c0a0a9562abe7e139e97e530 (patch) | |
| tree | 6f3da29157aeba9f2426df932027e58ea4c7a60f /src/game/localization.cpp | |
| parent | 3f05289328dfaeb67a344de0b553e31cbb11ea36 (diff) | |
| download | zcatch-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/localization.cpp')
| -rw-r--r-- | src/game/localization.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/game/localization.cpp b/src/game/localization.cpp index ad025100..69896300 100644 --- a/src/game/localization.cpp +++ b/src/game/localization.cpp @@ -63,6 +63,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", aBuf); m_Strings.clear(); + char aOrigin[512]; CLineReader LineReader; LineReader.Init(IoHandle); char *pLine; @@ -74,6 +75,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon if(pLine[0] == '#') // skip comments continue; + str_copy(aOrigin, pLine, sizeof(aOrigin)); char *pReplacement = LineReader.Get(); if(!pReplacement) { @@ -83,13 +85,13 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon if(pReplacement[0] != '=' || pReplacement[1] != '=' || pReplacement[2] != ' ') { - str_format(aBuf, sizeof(aBuf), "malform replacement line for '%s'", pLine); + str_format(aBuf, sizeof(aBuf), "malform replacement line for '%s'", aOrigin); pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", aBuf); continue; } pReplacement += 3; - AddString(pLine, pReplacement); + AddString(aOrigin, pReplacement); } io_close(IoHandle); |