diff options
Diffstat (limited to 'Minecraft.Client/StringTable.cpp')
| -rw-r--r-- | Minecraft.Client/StringTable.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Minecraft.Client/StringTable.cpp b/Minecraft.Client/StringTable.cpp index b0c46a7b..a29da179 100644 --- a/Minecraft.Client/StringTable.cpp +++ b/Minecraft.Client/StringTable.cpp @@ -11,6 +11,20 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) { src = byteArray(pbData, dwSize); + ProcessStringTableData(); +} + + +void StringTable::ReloadStringTable() +{ + m_stringsMap.clear(); + m_stringsVec.clear(); + + ProcessStringTableData(); +} + +void StringTable::ProcessStringTableData(void) +{ ByteArrayInputStream bais(src); DataInputStream dis(&bais); @@ -35,8 +49,8 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) // for( AUTO_VAR(it_locales, locales.begin()); - it_locales!=locales.end() && (!foundLang); - it_locales++ + it_locales!=locales.end() && (!foundLang); + it_locales++ ) { bytesToSkip = 0; @@ -72,7 +86,7 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) // Read the language file for the selected language int langVersion = dis2.readInt(); - + isStatic = false; // 4J-JEV: Versions 1 and up could use if (langVersion > 0) // integers rather than wstrings as keys. isStatic = dis2.readBoolean(); @@ -80,6 +94,8 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) wstring langId = dis2.readUTF(); int totalStrings = dis2.readInt(); + app.DebugPrintf("IsStatic=%d totalStrings = %d\n",isStatic?1:0,totalStrings); + if (!isStatic) { for(int i = 0; i < totalStrings; ++i) @@ -109,11 +125,12 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) isStatic = false; } - + // We can't delete this data in the dtor, so clear the reference bais.reset(); } + StringTable::~StringTable(void) { // delete src.data; TODO 4J-JEV: ? |
