From 9348bf5b242591fed73ab25db7c39d81d5213ef1 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 3 Jun 2020 11:04:36 -0700 Subject: [PATCH] Convert Game::loadtele() to TinyXML2 Again, the only thing that needs to be changed is just the code at the top of the function. --- desktop_version/src/Game.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 2c6084d6..0c2b8c6d 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6233,16 +6233,16 @@ void Game::customsavequick(std::string savfile) void Game::loadtele() { - TiXmlDocument doc; - if (!FILESYSTEM_loadTiXmlDocument("saves/tsave.vvv", &doc)) return; + tinyxml2::XMLDocument doc; + if (!FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", doc)) return; - 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) { @@ -6250,11 +6250,11 @@ void Game::loadtele() } // save this for later - hRoot=TiXmlHandle(pElem); + hRoot=tinyxml2::XMLHandle(pElem); } - 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() ;