Skip to content

Commit 05490c8

Browse files
author
imdex
committed
Resolved #3. TinyXML parser replaced by pugixml 1.8
1 parent 7572f67 commit 05490c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+16383
-3480
lines changed

code/engine/xrGame/EliteDetector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void CUIArtefactDetectorElite::construct(CEliteDetector* p) {
9393

9494
xr_sprintf(buff, "%s", p->ui_xml_tag());
9595
int num = uiXml.GetNodesNum(buff, 0, "palette");
96-
XML_NODE* pStoredRoot = uiXml.GetLocalRoot();
96+
XML_NODE pStoredRoot = uiXml.GetLocalRoot();
9797
uiXml.SetLocalRoot(uiXml.NavigateToNode(buff, 0));
9898
for (int idx = 0; idx < num; ++idx) {
9999
CUIStatic* S = xr_new<CUIStatic>();

code/engine/xrGame/PhraseDialog.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void CPhraseDialog::load_shared(LPCSTR) {
198198
pXML->SetLocalRoot(pXML->GetRoot());
199199

200200
// loading from XML
201-
XML_NODE* dialog_node = pXML->NavigateToNode(id_to_index::tag_name, item_data.pos_in_file);
201+
XML_NODE dialog_node = pXML->NavigateToNode(id_to_index::tag_name, item_data.pos_in_file);
202202
THROW3(dialog_node, "dialog id=", *item_data.id);
203203

204204
pXML->SetLocalRoot(dialog_node);
@@ -214,7 +214,7 @@ void CPhraseDialog::load_shared(LPCSTR) {
214214
//çàïîëíèòü ãðàô äèàëîãà ôðàçàìè
215215
data()->m_PhraseGraph.clear();
216216

217-
XML_NODE* phrase_list_node = pXML->NavigateToNode(dialog_node, "phrase_list", 0);
217+
XML_NODE phrase_list_node = pXML->NavigateToNode(dialog_node, "phrase_list", 0);
218218
if (NULL == phrase_list_node) {
219219
LPCSTR func = pXML->Read(dialog_node, "init_func", 0, "");
220220

@@ -236,7 +236,7 @@ void CPhraseDialog::load_shared(LPCSTR) {
236236
#endif
237237

238238
//èùåì ñòàðòîâóþ ôðàçó
239-
XML_NODE* phrase_node = pXML->NavigateToNodeWithAttribute("phrase", "id", "0");
239+
XML_NODE phrase_node = pXML->NavigateToNodeWithAttribute("phrase", "id", "0");
240240
THROW(phrase_node);
241241
AddPhrase(pXML, phrase_node, "0", "");
242242
}
@@ -266,7 +266,7 @@ CPhrase* CPhraseDialog::AddPhrase(LPCSTR text, const shared_str& phrase_id,
266266
return phrase;
267267
}
268268

269-
void CPhraseDialog::AddPhrase(CUIXml* pXml, XML_NODE* phrase_node, const shared_str& phrase_id,
269+
void CPhraseDialog::AddPhrase(CUIXml* pXml, XML_NODE phrase_node, const shared_str& phrase_id,
270270
const shared_str& prev_phrase_id) {
271271

272272
LPCSTR sText = pXml->Read(phrase_node, "text", 0, "");
@@ -285,7 +285,7 @@ void CPhraseDialog::AddPhrase(CUIXml* pXml, XML_NODE* phrase_node, const shared_
285285
int next_num = pXml->GetNodesNum(phrase_node, "next");
286286
for (int i = 0; i < next_num; ++i) {
287287
LPCSTR next_phrase_id_str = pXml->Read(phrase_node, "next", i, "");
288-
XML_NODE* next_phrase_node =
288+
XML_NODE next_phrase_node =
289289
pXml->NavigateToNodeWithAttribute("phrase", "id", next_phrase_id_str);
290290
R_ASSERT2(next_phrase_node, next_phrase_id_str);
291291
AddPhrase(pXml, next_phrase_node, next_phrase_id_str, phrase_id);

code/engine/xrGame/PhraseDialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class CPhraseDialog : public CSharedClass<SPhraseDialogData, shared_str, false>,
136136
virtual void load_shared(LPCSTR);
137137

138138
//ðåêóðñèâíîå äîáàâëåíèå ôðàç â ãðàô
139-
void AddPhrase(CUIXml* pXml, XML_NODE* phrase_node, const shared_str& phrase_id,
139+
void AddPhrase(CUIXml* pXml, XML_NODE phrase_node, const shared_str& phrase_id,
140140
const shared_str& prev_phrase_id);
141141

142142
public:

code/engine/xrGame/PhraseScript.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "actor.h"
1212

1313
//çàãðóçêà èç XML ôàéëà
14-
void CDialogScriptHelper::Load(CUIXml* uiXml, XML_NODE* phrase_node) {
14+
void CDialogScriptHelper::Load(CUIXml* uiXml, XML_NODE phrase_node) {
1515
LoadSequence(uiXml, phrase_node, "precondition", m_Preconditions);
1616
LoadSequence(uiXml, phrase_node, "action", m_ScriptActions);
1717

@@ -23,12 +23,12 @@ void CDialogScriptHelper::Load(CUIXml* uiXml, XML_NODE* phrase_node) {
2323
}
2424

2525
template <class T>
26-
void CDialogScriptHelper::LoadSequence(CUIXml* uiXml, XML_NODE* phrase_node, LPCSTR tag,
26+
void CDialogScriptHelper::LoadSequence(CUIXml* uiXml, XML_NODE phrase_node, LPCSTR tag,
2727
T& str_vector) {
2828
int tag_num = uiXml->GetNodesNum(phrase_node, tag);
2929
str_vector.clear();
3030
for (int i = 0; i < tag_num; ++i) {
31-
LPCSTR tag_text = uiXml->Read(phrase_node, tag, i, NULL);
31+
LPCSTR tag_text = uiXml->Read(phrase_node, tag, i, nullptr);
3232
str_vector.push_back(tag_text);
3333
}
3434
}

code/engine/xrGame/PhraseScript.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99

1010
class CGameObject;
1111
class CInventoryOwner;
12-
class TiXmlNode;
12+
class XML_NODE;
1313
class CUIXml;
1414

15-
typedef TiXmlNode XML_NODE;
16-
1715
class CDialogScriptHelper {
1816
public:
19-
void Load(CUIXml* ui_xml, XML_NODE* phrase_node);
17+
void Load(CUIXml* ui_xml, XML_NODE phrase_node);
2018

2119
bool Precondition(const CGameObject* pSpeaker, LPCSTR dialog_id, LPCSTR phrase_id) const;
2220
void Action(const CGameObject* pSpeaker, LPCSTR dialog_id, LPCSTR phrase_id) const;
@@ -45,7 +43,7 @@ class CDialogScriptHelper {
4543
protected:
4644
//çàãðóçêà ñîäåðæàíèÿ ïîñëåäîâàòåëüíîñòè òàãîâ â êîíòåéíåð ñòðîê
4745
template <class T>
48-
void LoadSequence(CUIXml* ui_xml, XML_NODE* phrase_node, LPCSTR tag, T& str_vector);
46+
void LoadSequence(CUIXml* ui_xml, XML_NODE phrase_node, LPCSTR tag, T& str_vector);
4947

5048
//ìàíèïóëÿöèè ñ èíôîðìàöèåé âî âðåìÿ âûçîâîâ Precondition è Action
5149
virtual bool CheckInfo(const CInventoryOwner* pOwner) const;

code/engine/xrGame/encyclopedia_article.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void CEncyclopediaArticle::load_shared(LPCSTR) {
5252
pXML->SetLocalRoot(pXML->GetRoot());
5353

5454
// loading from XML
55-
XML_NODE* pNode = pXML->NavigateToNode(id_to_index::tag_name, item_data.pos_in_file);
55+
XML_NODE pNode = pXML->NavigateToNode(id_to_index::tag_name, item_data.pos_in_file);
5656
THROW3(pNode, "encyclopedia article id=", *item_data.id);
5757

5858
//òåêñò

code/engine/xrGame/map_location.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ void CMapLocation::LoadSpot(LPCSTR type, bool bReload) {
9090
g_uiSpotXml->Load(CONFIG_PATH, UI_PATH, "map_spots.xml");
9191
}
9292

93-
XML_NODE* node = NULL;
9493
string512 path_base, path;
9594
xr_strcpy(path_base, type);
9695
R_ASSERT3(g_uiSpotXml->NavigateToNode(path_base, 0), "XML node not found in file map_spots.xml",
@@ -120,7 +119,7 @@ void CMapLocation::LoadSpot(LPCSTR type, bool bReload) {
120119
}
121120

122121
strconcat(sizeof(path), path, path_base, ":level_map");
123-
node = g_uiSpotXml->NavigateToNode(path, 0);
122+
XML_NODE node = g_uiSpotXml->NavigateToNode(path, 0);
124123
if (node) {
125124
LPCSTR str = g_uiSpotXml->ReadAttrib(path, 0, "spot", "");
126125
if (xr_strlen(str)) {

code/engine/xrGame/map_spot.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ void CMiniMapSpot::Load(CUIXml* xml, LPCSTR path) {
111111
inherited::Load(xml, path);
112112

113113
string256 buf;
114-
XML_NODE* n = NULL;
115114

116115
Frect base_rect;
117116
base_rect.x1 = 0;
@@ -122,7 +121,7 @@ void CMiniMapSpot::Load(CUIXml* xml, LPCSTR path) {
122121
Frect _stored_rect = m_UIStaticItem.GetTextureRect();
123122

124123
strconcat(sizeof(buf), buf, path, ":texture_above");
125-
n = xml->NavigateToNode(buf, 0);
124+
XML_NODE n = xml->NavigateToNode(buf, 0);
126125
if (n) {
127126
LPCSTR texture = xml->Read(buf, 0, NULL);
128127
CUITextureMaster::InitTexture(texture, &m_UIStaticItem);
@@ -231,8 +230,8 @@ void CComplexMapSpot::Load(CUIXml* xml, LPCSTR path) // complex_spot_template
231230
{
232231
inherited::Load(xml, path);
233232

234-
XML_NODE* stored_root = xml->GetLocalRoot();
235-
XML_NODE* node = xml->NavigateToNode(path, 0);
233+
XML_NODE stored_root = xml->GetLocalRoot();
234+
XML_NODE node = xml->NavigateToNode(path, 0);
236235
xml->SetLocalRoot(node);
237236

238237
m_left_icon = CreateStaticOrig(*xml, "left_icon");

code/engine/xrGame/ui/MMSound.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void CMMSound::Init(CUIXml& xml_doc, LPCSTR path) {
1313

1414
int nodes_num = xml_doc.GetNodesNum(path, 0, "menu_music");
1515

16-
XML_NODE* tab_node = xml_doc.NavigateToNode(path, 0);
16+
XML_NODE tab_node = xml_doc.NavigateToNode(path, 0);
1717
xml_doc.SetLocalRoot(tab_node);
1818
for (int i = 0; i < nodes_num; ++i)
1919
m_play_list.push_back(xml_doc.Read("menu_music", i, ""));

code/engine/xrGame/ui/UIAchievements.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ CUIAchievements::~CUIAchievements() { xr_delete(m_hint); }
1717
void CUIAchievements::init_from_xml(CUIXml& xml) {
1818
CUIXmlInit::InitWindow(xml, "achievements_itm", 0, this);
1919

20-
XML_NODE* stored_root = xml.GetLocalRoot();
21-
XML_NODE* node = xml.NavigateToNode("achievements_itm", 0);
20+
XML_NODE stored_root = xml.GetLocalRoot();
21+
XML_NODE node = xml.NavigateToNode("achievements_itm", 0);
2222
xml.SetLocalRoot(node);
2323

2424
m_name = UIHelper::CreateTextWnd(xml, "name", this);

0 commit comments

Comments
 (0)