From: Clyne Sullivan Date: Mon, 4 Apr 2016 18:56:43 +0000 (-0400) Subject: merge X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=4ea7b19bf2d4c64719471a53e6223aac7c250585;p=clyne%2Fgamedev.git merge --- 4ea7b19bf2d4c64719471a53e6223aac7c250585 diff --cc src/world.cpp index 73d8841,bcd4f7a..e009f78 --- a/src/world.cpp +++ b/src/world.cpp @@@ -1549,41 -1504,31 +1549,41 @@@ loadWorldFromXMLNoSave( std::string pat if ( path.empty() ) return NULL; - std::cout << "File path: " << path << std::endl; -- currentXML = std::string(xmlFolder + path); - std::cout << "Full file path: " << currentXML << std::endl; - - xml.LoadFile(currentXML.c_str()); - wxml = xml.FirstChildElement("World"); ++ currentXML = std::string(xmlFolder + path); + xml.LoadFile( currentXML.c_str() ); - if(wxml){ + // attempt to load a tag + if ( (wxml = xml.FirstChildElement("World")) ) { wxml = wxml->FirstChildElement(); vil = xml.FirstChildElement("World")->FirstChildElement("village"); - Indoor = false; tmp = new World(); - }else if((wxml = xml.FirstChildElement("IndoorWorld"))){ + Indoor = false; + } + + // attempt to load an tag + else if( (wxml = xml.FirstChildElement("IndoorWorld")) ) { wxml = wxml->FirstChildElement(); vil = NULL; - Indoor = true; tmp = new IndoorWorld(); + Indoor = true; } - while(wxml){ + // error: can't load a world... + else + UserError("XML Error: Cannot find a or tag in " + currentXML + "!"); + + // iterate through world tags + while ( wxml ) { name = wxml->Name(); + // world linkage if ( name == "link" ) { - if ((ptr = wxml->Attribute("left"))) { - tmp->setToLeft(ptr); + + // links world to the left + if ( (ptr = wxml->Attribute("left")) ) { + tmp->setToLeft( ptr ); + + // load the left world if it isn't if ( !loadedLeft ) { loadedLeft = true; currentWorldToLeft = loadWorldFromXMLNoSave( ptr );