| 46 | } |
| 47 | |
| 48 | void CStringTable::Load(LPCSTR xml_file) |
| 49 | { |
| 50 | CUIXml uiXml; |
| 51 | string_path xml_file_full; |
| 52 | strconcat(sizeof(xml_file_full), xml_file_full, xml_file, ".xml"); |
| 53 | string_path _s; |
| 54 | strconcat(sizeof(_s), _s, STRING_TABLE_PATH, "\\", *(pData->m_sLanguage)); |
| 55 | |
| 56 | bool xml_result = uiXml.Init(CONFIG_PATH, _s, xml_file_full); |
| 57 | if (!xml_result) |
| 58 | Debug.fatal(DEBUG_INFO, "string table xml file not found %s, for language %s", xml_file_full, *(pData->m_sLanguage)); |
| 59 | |
| 60 | //общий список всех записей таблицы в файле |
| 61 | int string_num = uiXml.GetNodesNum(uiXml.GetRoot(), "string"); |
| 62 | |
| 63 | for (int i = 0; i < string_num; ++i) |
| 64 | { |
| 65 | LPCSTR string_name = uiXml.ReadAttrib(uiXml.GetRoot(), "string", i, "id", NULL); |
| 66 | |
| 67 | if (WriteErrorsToLog && pData->m_StringTable.contains(string_name)) |
| 68 | Msg("!![%s] duplicate string table id: [%s]", __FUNCTION__, string_name); |
| 69 | |
| 70 | LPCSTR string_text = uiXml.Read(uiXml.GetRoot(), "string:text", i, NULL); |
| 71 | |
| 72 | VERIFY3(string_text, "string table entry does not has a text", string_name); |
| 73 | |
| 74 | STRING_VALUE str_val = ParseLine(string_text, string_name, true); |
| 75 | |
| 76 | pData->m_StringTable[string_name] = str_val; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | void CStringTable::ReloadLanguage() |
| 81 | { |
nothing calls this directly
no test coverage detected