From 45e864315e8e9e0ff23e0c69fb66cdccc8478c54 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 3 Jun 2020 19:26:54 -0700 Subject: [PATCH] Convert Game::loadsummary() to TinyXML2 --- desktop_version/src/Game.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 47fed1c4..0cef5d02 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5429,20 +5429,20 @@ void Game::customloadquick(std::string savfile) void Game::loadsummary() { - TiXmlDocument docTele; - if (!FILESYSTEM_loadTiXmlDocument("saves/tsave.vvv", &docTele)) + tinyxml2::XMLDocument docTele; + if (!FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", docTele)) { telesummary = ""; } else { - TiXmlHandle hDoc(&docTele); - TiXmlElement* pElem; - TiXmlHandle hRoot(0); + tinyxml2::XMLHandle hDoc(&docTele); + tinyxml2::XMLElement* pElem; + tinyxml2::XMLHandle hRoot(NULL); { - pElem=hDoc.FirstChildElement().Element(); + pElem=hDoc.FirstChildElement().ToElement(); // should always have a valid root but handle gracefully if it does if (!pElem) { @@ -5450,13 +5450,13 @@ void Game::loadsummary() } // save this for later - hRoot=TiXmlHandle(pElem); + hRoot=tinyxml2::XMLHandle(pElem); } int l_minute, l_second, l_hours; l_minute = l_second= l_hours = 0; int l_saveX = 0; int l_saveY = 0; - for( pElem = hRoot.FirstChild( "Data" ).FirstChild().Element(); pElem; pElem=pElem->NextSiblingElement()) + for( pElem = hRoot.FirstChildElement( "Data" ).FirstChild().ToElement(); pElem; pElem=pElem->NextSiblingElement()) { std::string pKey(pElem->Value()); const char* pText = pElem->GetText() ; @@ -5518,20 +5518,20 @@ void Game::loadsummary() tele_currentarea = map.currentarea(map.area(l_saveX, l_saveY)); } - TiXmlDocument doc; - if (!FILESYSTEM_loadTiXmlDocument("saves/qsave.vvv", &doc)) + tinyxml2::XMLDocument doc; + if (!FILESYSTEM_loadTiXml2Document("saves/qsave.vvv", doc)) { quicksummary = ""; } else { - TiXmlHandle hDoc(&doc); - TiXmlElement* pElem; - TiXmlHandle hRoot(0); + tinyxml2::XMLHandle hDoc(&doc); + tinyxml2::XMLElement* pElem; + tinyxml2::XMLHandle hRoot(NULL); { - pElem=hDoc.FirstChildElement().Element(); + pElem=hDoc.FirstChildElement().ToElement(); // should always have a valid root but handle gracefully if it does if (!pElem) { @@ -5539,13 +5539,13 @@ void Game::loadsummary() } // save this for later - hRoot=TiXmlHandle(pElem); + hRoot=tinyxml2::XMLHandle(pElem); } int l_minute, l_second, l_hours; l_minute = l_second= l_hours = 0; int l_saveX = 0; int l_saveY = 0; - for( pElem = hRoot.FirstChild( "Data" ).FirstChild().Element(); pElem; pElem=pElem->NextSiblingElement()) + for( pElem = hRoot.FirstChildElement( "Data" ).FirstChild().ToElement(); pElem; pElem=pElem->NextSiblingElement()) { std::string pKey(pElem->Value()); const char* pText = pElem->GetText() ;