Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5773 in orxonox.OLD for trunk/src/story_entities


Ignore:
Timestamp:
Nov 25, 2005, 1:07:55 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: changed to std::list in campaign

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/campaign.cc

    r5751 r5773  
    2525#include "camera.h"
    2626
    27 #include "list.h"
    28 
    2927#include "load_param.h"
    3028
     
    3634{
    3735  this->setClassID(CL_CAMPAIGN, "Campaign");
    38   this->entities = new tList<StoryEntity>();
    3936  this->isInit = false;
    4037}
     
    4845  assert( root != NULL);
    4946
    50   this->entities = new tList<StoryEntity>();
    5147  this->isInit = false;
    5248
     
    130126      int nextWorldID = se->getNextStoryID();
    131127
    132       this->entities->remove(se);
     128      this->entities.remove(se);
    133129      delete se;
    134130
     
    148144       this probably does not belong into the start function. remove this later
    149145    */
    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    }
    159151}
    160152
     
    212204void Campaign::addEntity(StoryEntity* se)
    213205{
    214   this->entities->add(se);
     206  this->entities.push_back(se);
    215207}
    216208
     
    225217void Campaign::removeEntity(StoryEntity* se)
    226218{
    227   this->entities->remove(se);
     219  this->entities.remove(se);
    228220}
    229221
     
    279271
    280272
    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();
    286277      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
    287278      if(id == storyID)
    288279        {
    289280          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
    290           delete iterator;
    291           return entity;
     281          return (*it);
    292282        }
    293       entity = iterator->nextElement();
    294     }
    295   delete iterator;
     283    }
     284
    296285
    297286
  • trunk/src/story_entities/campaign.h

    r4598 r5773  
    55#include "stdincl.h"
    66#include "story_entity.h"
    7 
     7#include <list>
    88
    99class World;
    1010class TiXmlElement;
    11 template<class T> class tList;
    1211
    1312class Campaign : public StoryEntity {
     
    4140 private:
    4241  //ListTemplate<StoryEntity>* entities;
    43   tList<StoryEntity>* entities;
    44   bool running;
     42   std::list<StoryEntity*> entities;
     43   bool running;
    4544
    46   StoryEntity* getStoryEntity(int storyID);
     45   StoryEntity* getStoryEntity(int storyID);
    4746};
    4847
Note: See TracChangeset for help on using the changeset viewer.