@@ -176,27 +176,30 @@ bool DataManager::LoadStrings(irr::io::IReadFile* reader) {
176176 linebuf.clear ();
177177 }
178178 }
179+ if (!linebuf.empty ()) {
180+ ReadStringConfLine (linebuf.data ());
181+ }
179182 reader->drop ();
180183 return true ;
181184}
182185void DataManager::ReadStringConfLine (const char * linebuf) {
183186 if (linebuf[0 ] != ' !' )
184187 return ;
185188 char strbuf[TEXT_LINE_SIZE ]{};
186- int value{};
189+ uint32_t value{};
187190 wchar_t strBuffer[4096 ]{};
188191 if (std::sscanf (linebuf, " !%63s" , strbuf) != 1 )
189192 return ;
190193 if (!std::strcmp (strbuf, " system" )) {
191- if (std::sscanf (&linebuf[7 ], " %d %240[^\n ]" , &value, strbuf) != 2 )
194+ if (std::sscanf (&linebuf[7 ], " %u %240[^\n ]" , &value, strbuf) != 2 )
192195 return ;
193196 BufferIO::DecodeUTF8 (strbuf, strBuffer);
194- _sysStrings[ value] = strBuffer;
197+ _sysStrings. emplace ( value, strBuffer) ;
195198 } else if (!std::strcmp (strbuf, " victory" )) {
196199 if (std::sscanf (&linebuf[8 ], " %x %240[^\n ]" , &value, strbuf) != 2 )
197200 return ;
198201 BufferIO::DecodeUTF8 (strbuf, strBuffer);
199- _victoryStrings[ value] = strBuffer;
202+ _victoryStrings. emplace ( value, strBuffer) ;
200203 } else if (!std::strcmp (strbuf, " counter" )) {
201204 if (std::sscanf (&linebuf[8 ], " %x %240[^\n ]" , &value, strbuf) != 2 )
202205 return ;
@@ -260,7 +263,7 @@ const wchar_t* DataManager::GetText(uint32_t code) const {
260263 return unknown_string;
261264}
262265const wchar_t * DataManager::GetDesc (uint32_t strCode) const {
263- if (strCode < ( MIN_CARD_ID << 4 ) )
266+ if (strCode <= MAX_STRING_ID )
264267 return GetSysString (strCode);
265268 unsigned int code = (strCode >> 4 ) & 0x0fffffff ;
266269 unsigned int offset = strCode & 0xf ;
0 commit comments