Changeset 3989 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/story_entities/campaign.cc
- Timestamp:
- Apr 27, 2005, 1:21:26 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/ll2trunktemp/src/story_entities/campaign.cc
r3832 r3989 19 19 #include "campaign.h" 20 20 21 #include "game_loader.h" 21 22 #include "story_entity.h" 22 23 … … 34 35 this->isInit = false; 35 36 } 36 37 Campaign::Campaign ( TiXmlElement* root) 38 { 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 this->entities = new tList<StoryEntity>(); 49 this->isInit = false; 50 51 // grab all the necessary parameters 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 60 // find WorldList 61 element = root->FirstChildElement( "WorldList"); 62 if( element == NULL) 63 { 64 PRINTF0("Campaign is missing a proper 'WorldList'\n"); 65 } 66 else 67 element = element->FirstChildElement(); 68 69 // load Worlds/Subcampaigns/Whatever 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); 83 } 37 84 38 85 Campaign::~Campaign () {}
Note: See TracChangeset
for help on using the changeset viewer.