Changeset 3557 in orxonox.OLD for orxonox/branches/levelloader
- Timestamp:
- Mar 15, 2005, 10:53:46 AM (20 years ago)
- Location:
- orxonox/branches/levelloader/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/game_loader.cc
r3542 r3557 282 282 BaseObject* GameLoader::fabricate( TiXmlElement* element) 283 283 { 284 assert( element != NULL); 285 284 286 if( first == NULL) 285 287 { … … 288 290 } 289 291 290 return first->fabricate( element); 291 } 292 if( element->Value() != NULL) 293 { 294 PRINTF0("Attempting fabrication of a '%s'\n", element->Value()); 295 BaseObject* b = first->fabricate( element); 296 if( b == NULL) PRINTF0("Failed to fabricate a '%s'\n", element->Value()); 297 else PRINTF0("Successfully fabricated a '%s'\n", element->Value()); 298 return b; 299 } 300 301 PRINTF0("Fabricate failed, TiXmlElement did not contain a value\n"); 302 303 return NULL; 304 } -
orxonox/branches/levelloader/src/lib/coord/p_node.cc
r3499 r3557 40 40 this->bAbsDirChanged = false; 41 41 this->parent = NULL; 42 this->objectName = NULL; 42 43 } 43 44 … … 59 60 this->bAbsDirChanged = false; 60 61 this->parent = parent; 61 62 this->objectName = NULL; 63 62 64 parent->addChild (this); 63 65 } … … 79 81 */ 80 82 this->parent = NULL; 83 if( this->objectName) delete this->objectName; 81 84 /* there is currently a problem with cleaning up - fix*/ 82 85 } … … 442 445 \brief set the name of the node 443 446 447 \todo Error free assignment of name by copying the string instead of keeping just the pointer 448 444 449 for debug purposes realy usefull, not used to work properly 445 450 */ 446 void PNode::setName (char* newName) 447 { 448 this->objectName = newName; 451 void PNode::setName (const char* newName) 452 { 453 int l = strlen( newName); 454 455 if( this->objectName != NULL) delete this->objectName; 456 this->objectName = NULL; 457 458 if( newName != NULL) 459 { 460 this->objectName = new char[l+1]; 461 462 for( int i = 0; i < l+1; i++) 463 this->objectName[i] = newName[i]; 464 } 449 465 } 450 466 … … 453 469 \brief gets the name of the node 454 470 */ 455 c har* PNode::getName ()471 const char* PNode::getName () 456 472 { 457 473 return this->objectName; -
orxonox/branches/levelloader/src/lib/coord/p_node.h
r3499 r3557 73 73 virtual void tick (float dt); 74 74 75 void setName (c har* newName);76 c har* getName ();75 void setName (const char* newName); 76 const char* getName (); 77 77 78 78 -
orxonox/branches/levelloader/src/story_entities/campaign.cc
r3542 r3557 42 42 int id; 43 43 44 PRINTF0("Loading Campaign...\n"); 45 44 46 assert( root != NULL); 45 47 GameLoader* loader = GameLoader::getInstance(); … … 52 54 if( string == NULL || sscanf(string, "%d", &id) != 1) 53 55 { 54 PRINTF (1)("Campaign is missing a proper 'identifier'\n");56 PRINTF0("Campaign is missing a proper 'identifier'\n"); 55 57 this->setStoryID( -1); 56 58 } … … 59 61 // find WorldList 60 62 element = root->FirstChildElement( "WorldList"); 63 if( element == NULL) 64 { 65 PRINTF0("Campaign is missing a proper 'WorldList'\n"); 66 } 67 else 68 element = element->FirstChildElement(); 61 69 62 70 // load Worlds/Subcampaigns/Whatever … … 81 89 } 82 90 83 84 ErrorMessage Campaign::start() 85 { 86 this->start(0); 87 } 88 89 90 ErrorMessage Campaign::start(int storyID = 0) 91 { 92 printf("World::start() - starting new StoryEntity Nr:%i\n", storyID); 91 ErrorMessage Campaign::start(int storyID) 92 { 93 printf("Camapaign::start() - starting new StoryEntity Nr:%i\n", storyID); 93 94 ErrorMessage errorCode; 94 95 if( !this->isInit) return errorCode; … … 97 98 StoryEntity* se = this->getStoryEntity(storyID); 98 99 this->currentEntity = se; 100 if( se == NULL) 101 { 102 printf("Camapaign::start() - Start StoryEntity not found\n"); 103 return errorCode; 104 } 99 105 while( se != NULL && this->running) 100 106 { -
orxonox/branches/levelloader/src/story_entities/campaign.h
r3530 r3557 19 19 20 20 virtual ErrorMessage init(); 21 virtual ErrorMessage start(); 22 virtual ErrorMessage start(int storyID); 21 virtual ErrorMessage start(int storyID = 0); 23 22 virtual ErrorMessage pause(); 24 23 virtual ErrorMessage resume(); -
orxonox/branches/levelloader/src/story_entities/world.cc
r3542 r3557 68 68 69 69 localPlayer = NULL; 70 this->entities = new tList<WorldEntity>(); 70 71 71 72 } … … 142 143 { 143 144 144 PRINTF0(" Loading world: '%s'\n", getPath());145 PRINTF0("> Loading world: '%s'\n", getPath()); 145 146 146 147 GameLoader* loader = GameLoader::getInstance(); … … 166 167 assert( root != NULL); 167 168 168 TiXmlElement* element = root->FirstChildElement( "WorldDataFile"); 169 170 if( root == NULL ) 169 if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile")) 171 170 { 172 171 // report an error … … 197 196 198 197 // find WorldEntities 199 element = root->FirstChildElement( "WorldEntities");198 TiXmlElement* element = root->FirstChildElement( "WorldEntities"); 200 199 201 200 if( element == NULL) … … 207 206 element = element->FirstChildElement(); 208 207 // load Players/Objects/Whatever 208 PRINTF0("Loading WorldEntities\n"); 209 209 while( element != NULL) 210 210 { 211 211 WorldEntity* created = (WorldEntity*) loader->fabricate( element); 212 if( created != NULL) spawn( created); 213 assert( element->Value() != NULL); 212 if( created != NULL) this->spawn( created); 214 213 // if we load a 'Player' we use it as localPlayer 215 if(!strcmp( element->Value(), "Player")) localPlayer = (Player*) created;214 // if( element->Value() != NULL && !strcmp( element->Value(), "Player")) localPlayer = (Player*) created; 216 215 element = element->NextSiblingElement(); 217 216 } 217 PRINTF0("Done loading WorldEntities\n"); 218 218 } 219 219 … … 227 227 { 228 228 //load track 229 trackManager = TrackManager::getInstance(); 229 PRINTF0("Loading Track\n"); 230 trackManager = TrackManager::getInstance(); 230 231 trackManager->loadTrack( element); 231 232 trackManager->finalize(); 233 PRINTF0("Done loading Track\n"); 232 234 } 233 235 … … 495 497 //gluNurbsProperty (theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR); 496 498 //gluNurbsProperty (theNurb, GLU_NURBS_VERTEX, vertexCallback ); 497 499 500 PRINTF0("> Done Loading world: '%s'\n", getPath()); 498 501 } 499 502 -
orxonox/branches/levelloader/src/track_manager.cc
r3530 r3557 705 705 { 706 706 assert( container->Value() != NULL); 707 if( sscanf( container->Value(), "%f,%f,%f", &x, &y, &z) == 3) 707 if( sscanf( container->Value(), "%lf,%lf,%lf", &x, &y, &z) == 3) 708 { 709 PRINTF0("Loaded Point: %lf,%lf,%lf (%s)\n", x, y, z, container->Value()); 708 710 addPoint( Vector( x, y, z)); 711 } 709 712 else 710 713 { 711 PRINTF (1)("Invalid Point in Track (skipped)\n");714 PRINTF0("Invalid Point in Track (skipped)\n"); 712 715 } 713 716 } … … 719 722 { 720 723 assert( container->Value() != NULL); 721 if( sscanf( container->Value(), "%f", &d) == 1) 724 if( sscanf( container->Value(), "%lf", &d) == 1) 725 { 726 PRINTF0("Loaded Duration: %lf (%s)\n", d, container->Value()); 722 727 setDuration( d); 728 } 723 729 else 724 730 { 725 PRINTF (1)("Invalid Duration in Track (skipped)\n");731 PRINTF0("Invalid Duration in Track (skipped)\n"); 726 732 } 727 733 } … … 729 735 else if( !strcmp( element->Value(), "SavePoint")) 730 736 { 737 PRINTF0("Loaded Savepoint\n"); 731 738 setSavePoint(); 732 739 } … … 737 744 { 738 745 assert( container->Value() != NULL); 746 PRINTF0("Loaded Fork: %s\n", container->Value()); 739 747 forkS( container->Value()); 740 748 } … … 746 754 { 747 755 assert( container->Value() != NULL); 756 PRINTF0("Loaded Join: %s\n", container->Value()); 748 757 joinS( container->Value()); 749 758 } … … 755 764 { 756 765 assert( container->Value() != NULL); 766 PRINTF0("Loaded WorkOn: %s\n", container->Value()); 757 767 workOnS( container->Value()); 758 768 } -
orxonox/branches/levelloader/src/world_entities/environment.cc
r3542 r3557 35 35 Environment::Environment ( TiXmlElement* root) 36 36 { 37 assert( root != NULL); 38 37 39 char* temp; 38 40 const char* string = grabParameter( root, "name"); 41 39 42 if( string == NULL) 40 43 { 41 PRINTF (1)("Environment is missing a proper 'name'\n");44 PRINTF0("Environment is missing a proper 'name'\n"); 42 45 string = "Unknown"; 43 temp = new char[strlen(string + 2)]; 44 strcpy( temp, string); 45 this->setName( temp); 46 this->setName( string); 46 47 } 47 48 else 48 49 { 49 temp = new char[strlen(string + 2)]; 50 strcpy( temp, string); 51 this->setName( temp); 50 this->setName( string); 52 51 } 53 52 … … 58 57 else 59 58 { 60 PRINTF (1)("Environment is missing a proper 'model'\n");59 PRINTF0("Environment is missing a proper 'model'\n"); 61 60 this->model = new OBJModel( "../data/models/reaplow.obj"); 62 61 } 63 62 if( this->model == NULL) 64 63 { 65 PRINTF (1)("Environment model '%s' could not be loaded\n", string);64 PRINTF0("Environment model '%s' could not be loaded\n", string); 66 65 } 67 66 … … 69 68 70 69 string = grabParameter( root, "position"); 71 if( string != NULL && sscanf( string, "% f,%f,%f", &(buff[0]), &(buff[1]), &(buff[2])) == 3)70 if( string != NULL && sscanf( string, "%lf,%lf,%lf", &(buff[0]), &(buff[1]), &(buff[2])) == 3) 72 71 { 73 72 Vector* es = new Vector( buff[0], buff[1], buff[2]); … … 77 76 else 78 77 { 79 PRINTF (1)("Environment is missing a proper 'position'\n");78 PRINTF0("Environment is missing a proper 'position'\n"); 80 79 Vector* es = new Vector(); 81 80 this->setAbsCoor(es); 82 81 delete es; 83 82 } 84 83 85 84 string = grabParameter( root, "orientation"); 86 if( string != NULL && sscanf( string, "% f,%f,%f", &(buff[0]), &(buff[1]), &(buff[2])) == 3)85 if( string != NULL && sscanf( string, "%lf,%lf,%lf", &(buff[0]), &(buff[1]), &(buff[2])) == 3) 87 86 { 88 87 Quaternion* qs = new Quaternion( buff[0], buff[1], buff[2]); … … 92 91 else 93 92 { 94 PRINTF (1)("Environment is missing a proper 'orientation'\n");93 PRINTF0("Environment is missing a proper 'orientation'\n"); 95 94 Quaternion* qs = new Quaternion (); 96 95 this->setAbsDir(qs);
Note: See TracChangeset
for help on using the changeset viewer.