Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 14, 2008, 3:42:49 AM (16 years ago)
Author:
landauf
Message:

merged core2 back to trunk
there might be some errors, wasn't able to test it yet due to some strange g++ and linker behaviour.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/core/Loader.cc

    r1021 r1052  
    3434#include "CoreIncludes.h"
    3535#include "Script.h"
     36#include "Namespace.h"
    3637
    3738#include "util/tinyxml/ticpp.h"
     
    129130            xmlfile.Parse(lua->getLuaOutput(), true);
    130131
    131             for ( ticpp::Iterator<ticpp::Element> child = xmlfile.FirstChildElement(false); child != child.end(); child++ )
    132             {
    133                 Identifier* identifier = ID(child->Value());
    134                 if (identifier)
    135                 {
    136                     if (Loader::currentMask_s.isIncluded(identifier))
    137                     {
    138                         COUT(4) << "  fabricating " << child->Value() << "..." << std::endl;
    139                         BaseObject* newObject = identifier->fabricate();
    140                         newObject->setLoaderIndentation("    ");
    141                         newObject->setLevel(level);
    142                         newObject->XMLPort(*child, true);
    143                         COUT(5) << "  ...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
    144                     }
    145                 }
    146                 else
    147                 {
    148                     COUT(2) << "  Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
    149                 }
    150             }
     132            ticpp::Element rootElement;
     133            rootElement.SetAttribute("name", "root");
     134            rootElement.SetAttribute("bAutogenerated", true);
     135
     136            for (ticpp::Iterator<ticpp::Element> child = xmlfile.FirstChildElement(false); child != child.end(); child++)
     137                rootElement.InsertEndChild(*child);
     138
     139            COUT(4) << "  creating root-namespace..." << std::endl;
     140            Namespace* rootNamespace = new Namespace();
     141            rootNamespace->setLoaderIndentation("    ");
     142            rootNamespace->setLevel(level);
     143            rootNamespace->setNamespace(rootNamespace);
     144            rootNamespace->setRoot(true);
     145            rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
    151146
    152147            COUT(0) << "Finished loading " << level->getFile() << "." << std::endl;
     148
     149            COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString("  ") << std::endl;
    153150
    154151            return true;
Note: See TracChangeset for help on using the changeset viewer.