mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Convert Game::loadstats() to TinyXML2
Surprisingly, I only had to change some names and stuff around at the top of the function. The rest of the function could be left untouched and it worked fine.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "FileSystemUtils.h"
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
#include "Network.h"
|
||||
|
||||
@@ -4231,20 +4232,20 @@ void Game::unlocknum( int t )
|
||||
|
||||
void Game::loadstats()
|
||||
{
|
||||
TiXmlDocument doc;
|
||||
if (!FILESYSTEM_loadTiXmlDocument("saves/unlock.vvv", &doc))
|
||||
tinyxml2::XMLDocument doc;
|
||||
if (!FILESYSTEM_loadTiXml2Document("saves/unlock.vvv", doc))
|
||||
{
|
||||
savestats();
|
||||
printf("No Stats found. Assuming a new player\n");
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -4253,14 +4254,14 @@ void Game::loadstats()
|
||||
;
|
||||
|
||||
// save this for later
|
||||
hRoot=TiXmlHandle(pElem);
|
||||
hRoot=tinyxml2::XMLHandle(pElem);
|
||||
}
|
||||
|
||||
// WINDOW DIMS, ADDED AT PATCH 22
|
||||
int width = 320;
|
||||
int height = 240;
|
||||
|
||||
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() ;
|
||||
|
||||
Reference in New Issue
Block a user