Changeset 3530 in orxonox.OLD for orxonox/branches/levelloader/src/game_loader.cc
- Timestamp:
- Mar 13, 2005, 10:40:25 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/game_loader.cc
r3525 r3530 15 15 co-programmer: ... 16 16 */ 17 18 17 19 18 #include "game_loader.h" … … 162 161 if( name == NULL) 163 162 { 164 PRINTF( ERR)("No filename specified for loading");163 PRINTF(1)("No filename specified for loading"); 165 164 return NULL; 166 165 } … … 168 167 TiXmlDocument* XMLDoc = new TiXmlDocument( name); 169 168 // load the campaign document 170 if( !XMLDoc .LoadFile())169 if( !XMLDoc->LoadFile()) 171 170 { 172 171 // 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()); 174 173 delete XMLDoc; 175 174 return NULL; … … 177 176 178 177 // check basic validity 179 TiXmlElement* element = XMLDoc .RootElement();178 TiXmlElement* element = XMLDoc->RootElement(); 180 179 assert( element != NULL); 181 180 … … 185 184 { 186 185 // 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"); 188 187 delete XMLDoc; 189 188 return NULL; … … 191 190 192 191 // construct campaign 193 Campaign c = new Campaign( element);192 Campaign* c = new Campaign( element); 194 193 195 194 // free the XML data 196 195 delete XMLDoc; 196 197 return c; 197 198 } 198 199 … … 269 270 void GameLoader::registerFactory( Factory* factory) 270 271 { 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); 273 278 } 274 279 … … 277 282 \param element a XMLElement containing all the needed info 278 283 */ 279 StoryEntity* GameLoader::fabricate( TiXmlElement* element)284 BaseObject* GameLoader::fabricate( TiXmlElement* element) 280 285 { 281 286 if( first == NULL) 282 287 { 283 PRINTF( ERR)("GameLoader does not know any factories, fabricate() failed\n");288 PRINTF(1)("GameLoader does not know any factories, fabricate() failed\n"); 284 289 return NULL; 285 290 }
Note: See TracChangeset
for help on using the changeset viewer.