Changeset 3994 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/story_entities
- Timestamp:
- Apr 27, 2005, 1:50:23 PM (20 years ago)
- Location:
- orxonox/branches/ll2trunktemp/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/ll2trunktemp/src/story_entities/campaign.cc
r3989 r3994 37 37 Campaign::Campaign ( TiXmlElement* root) 38 38 { 39 40 41 42 43 44 45 46 47 39 TiXmlElement* element; 40 const char* string; 41 int id; 42 43 PRINTF0("Loading Campaign...\n"); 44 45 assert( root != NULL); 46 GameLoader* loader = GameLoader::getInstance(); 47 48 48 this->entities = new tList<StoryEntity>(); 49 49 this->isInit = false; 50 50 51 51 // grab all the necessary parameters 52 53 54 55 56 57 58 52 string = grabParameter( root, "identifier"); 53 if( string == NULL || sscanf(string, "%d", &id) != 1) 54 { 55 PRINTF0("Campaign is missing a proper 'identifier'\n"); 56 this->setStoryID( -1); 57 } 58 else this->setStoryID( id); 59 59 60 60 // find WorldList 61 61 element = root->FirstChildElement( "WorldList"); 62 62 if( element == NULL) 63 {64 65 }63 { 64 PRINTF0("Campaign is missing a proper 'WorldList'\n"); 65 } 66 66 else 67 67 element = element->FirstChildElement(); 68 68 69 69 // load Worlds/Subcampaigns/Whatever 70 70 StoryEntity* lastCreated = NULL; 71 while( element != NULL) 72 { 73 StoryEntity* created = (StoryEntity*) loader->fabricate( element); 74 if( lastCreated != NULL) created->setNextStoryID( lastCreated->getStoryID()); 75 if( created != NULL) 76 { 77 this->addEntity( created); 78 lastCreated = created; 79 } 80 element = element->NextSiblingElement(); 81 } 82 if( lastCreated != NULL) lastCreated->setStoryID( WORLD_ID_GAMEEND); 71 while( element != NULL) 72 { 73 printf("Campaign: Constructor: adding a world\n"); 74 StoryEntity* created = (StoryEntity*) loader->fabricate( element); 75 /* 76 if( lastCreated != NULL) 77 created->setNextStoryID( lastCreated->getStoryID()); 78 else 79 created->setNextStoryID( WORLD_ID_GAMEEND); 80 */ 81 if( created != NULL) 82 { 83 this->addEntity( created); 84 lastCreated = created; 85 } 86 element = element->NextSiblingElement(); 87 } 88 //if( lastCreated != NULL) 89 //lastCreated->setStoryID( WORLD_ID_GAMEEND); 83 90 } 84 91 -
orxonox/branches/ll2trunktemp/src/story_entities/world.cc
r3992 r3994 120 120 this->constuctorInit("", -1); 121 121 122 const char *string; 123 char *name; 124 int id; 125 126 PRINTF0("Creating a World\n"); 127 128 // identifier 129 string = grabParameter( root, "identifier"); 130 if( string == NULL || sscanf(string, "%d", &id) != 1) 131 { 132 PRINTF0("World is missing a proper 'identifier'\n"); 133 this->setStoryID( -1); 134 } 135 else setStoryID( id); 136 137 // path 138 string = grabParameter( root, "path"); 139 if( string == NULL) 140 { 141 PRINTF0("World is missing a proper 'path'\n"); 142 this->setPath( NULL); 143 } 144 else 145 { 146 name = new char[strlen(string + 2)]; 147 strcpy( name, string); 148 this->setPath( name); 149 } 122 const char *string; 123 char *name; 124 int id; 125 126 PRINTF0("Creating a World\n"); 127 128 // identifier 129 string = grabParameter( root, "identifier"); 130 if( string == NULL || sscanf(string, "%d", &id) != 1) 131 { 132 PRINTF0("World is missing a proper 'identifier'\n"); 133 this->setStoryID( -1); 134 } 135 else setStoryID( id); 136 137 // next id 138 string = grabParameter( root, "nextid"); 139 if( string == NULL || sscanf(string, "%d", &id) != 1) 140 { 141 PRINTF0("World is missing a proper 'nextid'\n"); 142 this->setStoryID( -1); 143 } 144 else setNextStoryID( id); 145 146 147 // path 148 string = grabParameter( root, "path"); 149 if( string == NULL) 150 { 151 PRINTF0("World is missing a proper 'path'\n"); 152 this->setPath( NULL); 153 } 154 else 155 { 156 name = new char[strlen(string + 2)]; 157 strcpy( name, string); 158 this->setPath( name); 159 } 150 160 151 161 this->localPlayer = NULL;
Note: See TracChangeset
for help on using the changeset viewer.