Changeset 6992 in orxonox.OLD for trunk/src/story_entities/game_world.cc
- Timestamp:
- Feb 2, 2006, 10:55:43 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r6989 r6992 88 88 89 89 this->dataXML = NULL; 90 this->path = NULL;91 90 } 92 91 … … 111 110 { 112 111 StoryEntity::loadParams(root); 113 114 LoadParam(root, "path", this, GameWorld, setPath)115 .describe("The Filename of this GameWorld (relative from the data-dir)");116 112 117 113 PRINTF(4)("Loaded GameWorld specific stuff\n"); … … 145 141 PRINTF(0)("Loading the GameWorld\n"); 146 142 147 PRINTF(3)("> Loading world: '%s'\n", get Path());143 PRINTF(3)("> Loading world: '%s'\n", getLoadFile()); 148 144 TiXmlElement* element; 149 145 GameLoader* loader = GameLoader::getInstance(); 150 146 151 if( get Path() == NULL)147 if( getLoadFile() == NULL) 152 148 { 153 149 PRINTF(1)("GameWorld has no path specified for loading\n"); … … 155 151 } 156 152 157 TiXmlDocument* XMLDoc = new TiXmlDocument( get Path());153 TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile()); 158 154 // load the xml world file for further loading 159 155 if( !XMLDoc->LoadFile()) 160 156 { 161 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->get Path(), 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()); 162 158 delete XMLDoc; 163 159 return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"}; … … 444 440 } 445 441 446 447 /**448 * sets the track path of this world449 * @param name the name of the path450 */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 else461 {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 468 442 /** 469 443 * shows the loading screen
Note: See TracChangeset
for help on using the changeset viewer.