Changeset 5773 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Nov 25, 2005, 1:07:55 AM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/campaign.cc
r5751 r5773 25 25 #include "camera.h" 26 26 27 #include "list.h"28 29 27 #include "load_param.h" 30 28 … … 36 34 { 37 35 this->setClassID(CL_CAMPAIGN, "Campaign"); 38 this->entities = new tList<StoryEntity>();39 36 this->isInit = false; 40 37 } … … 48 45 assert( root != NULL); 49 46 50 this->entities = new tList<StoryEntity>();51 47 this->isInit = false; 52 48 … … 130 126 int nextWorldID = se->getNextStoryID(); 131 127 132 this->entities ->remove(se);128 this->entities.remove(se); 133 129 delete se; 134 130 … … 148 144 this probably does not belong into the start function. remove this later 149 145 */ 150 tIterator<StoryEntity>* it = this->entities->getIterator(); 151 se = it->firstElement(); 152 while( se != NULL) 153 { 154 delete se; 155 se = it->nextElement(); 156 } 157 delete this->entities; 158 delete it; 146 list<StoryEntity*>::iterator it; 147 for(it = this->entities.begin(); it != entities.end(); it++) 148 { 149 delete (*it); 150 } 159 151 } 160 152 … … 212 204 void Campaign::addEntity(StoryEntity* se) 213 205 { 214 this->entities ->add(se);206 this->entities.push_back(se); 215 207 } 216 208 … … 225 217 void Campaign::removeEntity(StoryEntity* se) 226 218 { 227 this->entities ->remove(se);219 this->entities.remove(se); 228 220 } 229 221 … … 279 271 280 272 281 tIterator<StoryEntity>* iterator = this->entities->getIterator(); 282 StoryEntity* entity = iterator->firstElement(); 283 while( entity != NULL) 284 { 285 int id = entity->getStoryID(); 273 list<StoryEntity*>::iterator it; 274 for (it = this->entities.begin(); it != this->entities.end(); it++) 275 { 276 int id = (*it)->getStoryID(); 286 277 //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id); 287 278 if(id == storyID) 288 279 { 289 280 //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n"); 290 delete iterator; 291 return entity; 281 return (*it); 292 282 } 293 entity = iterator->nextElement(); 294 } 295 delete iterator; 283 } 284 296 285 297 286 -
trunk/src/story_entities/campaign.h
r4598 r5773 5 5 #include "stdincl.h" 6 6 #include "story_entity.h" 7 7 #include <list> 8 8 9 9 class World; 10 10 class TiXmlElement; 11 template<class T> class tList;12 11 13 12 class Campaign : public StoryEntity { … … 41 40 private: 42 41 //ListTemplate<StoryEntity>* entities; 43 tList<StoryEntity>*entities;44 bool running;42 std::list<StoryEntity*> entities; 43 bool running; 45 44 46 StoryEntity* getStoryEntity(int storyID);45 StoryEntity* getStoryEntity(int storyID); 47 46 }; 48 47
Note: See TracChangeset
for help on using the changeset viewer.