Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6992 in orxonox.OLD for trunk/src/story_entities/game_world.cc


Ignore:
Timestamp:
Feb 2, 2006, 10:55:43 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: now the StoryEntity stores the path it was loaded with, not the GameWorld

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r6989 r6992  
    8888
    8989  this->dataXML = NULL;
    90   this->path = NULL;
    9190}
    9291
     
    111110{
    112111  StoryEntity::loadParams(root);
    113 
    114   LoadParam(root, "path", this, GameWorld, setPath)
    115       .describe("The Filename of this GameWorld (relative from the data-dir)");
    116112
    117113  PRINTF(4)("Loaded GameWorld specific stuff\n");
     
    145141  PRINTF(0)("Loading the GameWorld\n");
    146142
    147   PRINTF(3)("> Loading world: '%s'\n", getPath());
     143  PRINTF(3)("> Loading world: '%s'\n", getLoadFile());
    148144  TiXmlElement* element;
    149145  GameLoader* loader = GameLoader::getInstance();
    150146
    151   if( getPath() == NULL)
     147  if( getLoadFile() == NULL)
    152148  {
    153149    PRINTF(1)("GameWorld has no path specified for loading\n");
     
    155151  }
    156152
    157   TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
     153  TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile());
    158154  // load the xml world file for further loading
    159155  if( !XMLDoc->LoadFile())
    160156  {
    161     PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     157    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    162158    delete XMLDoc;
    163159    return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"};
     
    444440}
    445441
    446 
    447 /**
    448  *  sets the track path of this world
    449  * @param name the name of the path
    450  */
    451 void GameWorld::setPath( const char* name)
    452 {
    453   if (this->path)
    454     delete this->path;
    455   if (ResourceManager::isFile(name))
    456   {
    457     this->path = new char[strlen(name)+1];
    458     strcpy(this->path, name);
    459   }
    460   else
    461   {
    462     this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];
    463     sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
    464   }
    465 }
    466 
    467 
    468442/**
    469443 *  shows the loading screen
Note: See TracChangeset for help on using the changeset viewer.