]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
merge
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 4 Apr 2016 18:56:43 +0000 (14:56 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 4 Apr 2016 18:56:43 +0000 (14:56 -0400)
1  2 
src/entities.cpp
src/world.cpp

Simple merge
diff --cc src/world.cpp
index 73d8841008e5427fb60bd6dacc1b18998366cecf,bcd4f7a297d60e6793b695f5c8f3140a24b502cc..e009f78ceb65ebd8b4d27b5484bbc9712e4ff1b9
@@@ -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 <World> 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 <IndoorWorld> 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 <World> or <IndoorWorld> 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 );