Changeset 3220 in orxonox.OLD for orxonox/trunk/src/campaign.cc
- Timestamp:
- Dec 19, 2004, 9:09:36 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/campaign.cc
r3209 r3220 48 48 want to queue up in the campaign. 49 49 */ 50 void Campaign::addEntity(StoryEntity* se, Uint32storyID)50 void Campaign::addEntity(StoryEntity* se, int storyID) 51 51 { 52 52 se->setStoryID(storyID); … … 60 60 61 61 62 void Campaign::removeEntity( Uint32storyID)62 void Campaign::removeEntity(int storyID) 63 63 { 64 64 this->removeEntity(this->getStoryEntity(storyID)); … … 78 78 } 79 79 80 Error Campaign::start( Uint32storyID = 0)80 Error Campaign::start(int storyID = 0) 81 81 { 82 82 printf("World::start() - starting new StoryEntity Nr:%i\n", storyID); … … 86 86 this->running = true; 87 87 StoryEntity* se = this->getStoryEntity(storyID); 88 this->currentEntity = se; 88 89 while(se != NULL && this->running) 89 90 { 90 se = this->getStoryEntity(storyID); 91 this->currentEntity = se; 91 //se = this->getStoryEntity(storyID); 92 92 93 se->displayEntityScreen(); 93 94 se->displayLoadScreen(); 94 95 se->load(); 95 96 se->init(); 96 se->release EntityScreen();97 se->releaseLoadScreen(); 97 98 se->start(); 98 99 100 delete se; 101 99 102 int nextWorldID = se->getNextStoryID(); 100 if(nextWorldID == WORLD_ID_GAMEEND) return errorCode;103 //printf("Campaing::start() - got nextWorldID = %i\n", nextWorldID); 101 104 se = this->getStoryEntity(nextWorldID); 102 if(se == NULL) 103 printf("Campaign::start() - ERROR: world not found, oh oh...\n"); 105 this->currentEntity = se; 106 if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) ) 107 { 108 printf("Campaign::start() - quiting campaing story loop\n"); 109 if(se != NULL) 110 delete se; 111 return errorCode; 112 } 113 104 114 } 105 115 } … … 111 121 { 112 122 this->currentEntity->stop(); 113 delete this->currentEntity;114 this->currentEntity = NULL;123 //delete this->currentEntity; 124 //this->currentEntity = NULL; 115 125 } 116 126 } … … 130 140 131 141 142 void Campaign::destroy() 143 { 144 if(this->currentEntity != NULL) 145 { 146 this->currentEntity->destroy(); 147 delete this->currentEntity; 148 this->currentEntity = NULL; 149 } 150 } 151 132 152 void Campaign::nextLevel() 133 153 { 134 printf("Campaign|nextLevel\n"); 135 int nextID = this->currentEntity->getNextStoryID(); 136 this->stop(); 137 this->start(nextID); 154 printf("Campaign:nextLevel()\n"); 155 //int nextID = this->currentEntity->getNextStoryID(); 156 //this->stop(); 157 //this->start(nextID); 158 this->currentEntity->stop(); 138 159 } 139 160 … … 142 163 143 164 144 StoryEntity* Campaign::getStoryEntity( Uint32storyID)165 StoryEntity* Campaign::getStoryEntity(int storyID) 145 166 { 167 //printf("Campaing::getStoryEntity(%i) - getting next Entity\n", storyID); 168 if( storyID == WORLD_ID_GAMEEND) 169 return NULL; 146 170 ListTemplate<StoryEntity>* l; 147 StoryEntity* entity ;171 StoryEntity* entity = NULL; 148 172 l = this->entities->get_next(); 149 173 while( l != NULL) … … 151 175 entity = l->get_object(); 152 176 l = l->get_next(); 153 if(entity->getStoryID() == storyID) 154 return entity; 177 int id = entity->getStoryID(); 178 //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id); 179 if(id == storyID) 180 { 181 //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n"); 182 return entity; 183 } 155 184 } 156 185 return NULL;
Note: See TracChangeset
for help on using the changeset viewer.