1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-01 00:39:41 +01:00

Convert Game::loadsummary() to TinyXML2

This commit is contained in:
Misa 2020-06-03 19:26:54 -07:00 committed by Ethan Lee
parent 89a8623a46
commit 45e864315e

View file

@ -5429,20 +5429,20 @@ void Game::customloadquick(std::string savfile)
void Game::loadsummary() void Game::loadsummary()
{ {
TiXmlDocument docTele; tinyxml2::XMLDocument docTele;
if (!FILESYSTEM_loadTiXmlDocument("saves/tsave.vvv", &docTele)) if (!FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", docTele))
{ {
telesummary = ""; telesummary = "";
} }
else else
{ {
TiXmlHandle hDoc(&docTele); tinyxml2::XMLHandle hDoc(&docTele);
TiXmlElement* pElem; tinyxml2::XMLElement* pElem;
TiXmlHandle hRoot(0); tinyxml2::XMLHandle hRoot(NULL);
{ {
pElem=hDoc.FirstChildElement().Element(); pElem=hDoc.FirstChildElement().ToElement();
// should always have a valid root but handle gracefully if it does // should always have a valid root but handle gracefully if it does
if (!pElem) if (!pElem)
{ {
@ -5450,13 +5450,13 @@ void Game::loadsummary()
} }
// save this for later // save this for later
hRoot=TiXmlHandle(pElem); hRoot=tinyxml2::XMLHandle(pElem);
} }
int l_minute, l_second, l_hours; int l_minute, l_second, l_hours;
l_minute = l_second= l_hours = 0; l_minute = l_second= l_hours = 0;
int l_saveX = 0; int l_saveX = 0;
int l_saveY = 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()); std::string pKey(pElem->Value());
const char* pText = pElem->GetText() ; const char* pText = pElem->GetText() ;
@ -5518,20 +5518,20 @@ void Game::loadsummary()
tele_currentarea = map.currentarea(map.area(l_saveX, l_saveY)); tele_currentarea = map.currentarea(map.area(l_saveX, l_saveY));
} }
TiXmlDocument doc; tinyxml2::XMLDocument doc;
if (!FILESYSTEM_loadTiXmlDocument("saves/qsave.vvv", &doc)) if (!FILESYSTEM_loadTiXml2Document("saves/qsave.vvv", doc))
{ {
quicksummary = ""; quicksummary = "";
} }
else else
{ {
TiXmlHandle hDoc(&doc); tinyxml2::XMLHandle hDoc(&doc);
TiXmlElement* pElem; tinyxml2::XMLElement* pElem;
TiXmlHandle hRoot(0); tinyxml2::XMLHandle hRoot(NULL);
{ {
pElem=hDoc.FirstChildElement().Element(); pElem=hDoc.FirstChildElement().ToElement();
// should always have a valid root but handle gracefully if it does // should always have a valid root but handle gracefully if it does
if (!pElem) if (!pElem)
{ {
@ -5539,13 +5539,13 @@ void Game::loadsummary()
} }
// save this for later // save this for later
hRoot=TiXmlHandle(pElem); hRoot=tinyxml2::XMLHandle(pElem);
} }
int l_minute, l_second, l_hours; int l_minute, l_second, l_hours;
l_minute = l_second= l_hours = 0; l_minute = l_second= l_hours = 0;
int l_saveX = 0; int l_saveX = 0;
int l_saveY = 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()); std::string pKey(pElem->Value());
const char* pText = pElem->GetText() ; const char* pText = pElem->GetText() ;