Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 13, 2005, 10:40:25 PM (19 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Got the system to compile, the basic backbone now runs. What remains to be done is implementing all necessary functions to load all vital classes into a world

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/game_loader.cc

    r3525 r3530  
    1515   co-programmer: ...
    1616*/
    17 
    1817
    1918#include "game_loader.h"
     
    162161  if( name == NULL)
    163162  {
    164                 PRINTF(ERR)("No filename specified for loading");
     163                PRINTF(1)("No filename specified for loading");
    165164                return NULL;
    166165  }
     
    168167        TiXmlDocument* XMLDoc = new TiXmlDocument( name);
    169168        // load the campaign document
    170         if( !XMLDoc.LoadFile())
     169        if( !XMLDoc->LoadFile())
    171170        {
    172171                // report an error
    173                 PRINTF(ERR)("Error loading XML File: %s @ %d:%d\n", XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
     172                PRINTF(1)("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    174173                delete XMLDoc;
    175174                return NULL;
     
    177176       
    178177        // check basic validity
    179         TiXmlElement* element = XMLDoc.RootElement();
     178        TiXmlElement* element = XMLDoc->RootElement();
    180179        assert( element != NULL);
    181180       
     
    185184        {
    186185                // report an error
    187                 PRINTF(ERR)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
     186                PRINTF(1)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
    188187                delete XMLDoc;
    189188                return NULL;
     
    191190       
    192191        // construct campaign
    193         Campaign c = new Campaign( element);
     192        Campaign* c = new Campaign( element);
    194193       
    195194        // free the XML data
    196195        delete XMLDoc;
     196       
     197        return c;
    197198}
    198199
     
    269270void GameLoader::registerFactory( Factory* factory)
    270271{
    271         if( next == NULL) next = factory;
    272         else next->registerFactory( factory);
     272        assert( factory != NULL);
     273       
     274        printf("Registered factory for '%s'\n", factory->getClassname());
     275       
     276        if( first == NULL) first = factory;
     277        else first->registerFactory( factory);
    273278}
    274279
     
    277282   \param element a XMLElement containing all the needed info
    278283*/
    279 StoryEntity* GameLoader::fabricate( TiXmlElement* element)
     284BaseObject* GameLoader::fabricate( TiXmlElement* element)
    280285{
    281286        if( first == NULL)
    282287        {
    283                 PRINTF(ERR)("GameLoader does not know any factories, fabricate() failed\n");
     288                PRINTF(1)("GameLoader does not know any factories, fabricate() failed\n");
    284289                return NULL;
    285290        }
Note: See TracChangeset for help on using the changeset viewer.