Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4816 in orxonox.OLD


Ignore:
Timestamp:
Jul 7, 2005, 4:24:58 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: the story entities now get deleted properly on shutdown

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/event/event_handler.cc

    r4783 r4816  
    146146void EventHandler::unsubscribe(EventListener* el, elState state)
    147147{
     148  if( el == NULL)
     149    return;
    148150  if( state == ES_ALL)
    149151    {
  • orxonox/trunk/src/story_entities/campaign.cc

    r4600 r4816  
    5757}
    5858
    59 Campaign::~Campaign () {}
     59Campaign::~Campaign ()
     60{}
    6061
    6162
     
    133134      se->destroy();
    134135
     136      this->entities->remove(se);
    135137      delete se;
    136138
     
    146148          return errorCode;
    147149        }
    148 
    149     }
     150    }
     151
     152    /* clean up all world that have not been loaded and therefore are still in the world list  -
     153       this probably does not belong into the start function. remove this later
     154    */
     155    tIterator<StoryEntity>* it = this->entities->getIterator();
     156    se = it->nextElement();
     157    while( se != NULL)
     158    {
     159      delete se;
     160      se = it->nextElement();
     161    }
     162    delete this->entities;
    150163}
    151164
     
    171184    {
    172185      this->currentEntity->stop();
    173       //delete this->currentEntity;
    174       //this->currentEntity = NULL;
    175186    }
    176187}
     
    228239{
    229240  printf("Campaign:nextLevel()\n");
    230   //int nextID = this->currentEntity->getNextStoryID();
    231   //this->stop();
    232   //this->start(nextID);
    233241  this->currentEntity->stop();
    234242}
  • orxonox/trunk/src/util/loading/game_loader.cc

    r4739 r4816  
    4949   \brief simple deconstructor
    5050*/
    51 GameLoader::~GameLoader () {}
     51GameLoader::~GameLoader ()
     52{
     53  if( this->currentCampaign)
     54    delete this->currentCampaign;
     55  this->currentCampaign = NULL;
     56}
    5257
    5358
     
    97102      delete campaignName;
    98103    }
    99   World* world0 = new World(DEBUG_WORLD_0);
    100   world0->setNextStoryID(WORLD_ID_GAMEEND);
    101   this->currentCampaign->addEntity(world0, WORLD_ID_2);
     104//   World* world0 = new World(DEBUG_WORLD_0);
     105//   world0->setNextStoryID(WORLD_ID_GAMEEND);
     106//   this->currentCampaign->addEntity(world0, WORLD_ID_2);
    102107}
    103108
     
    165170  if(this->currentCampaign != NULL)
    166171    this->currentCampaign->stop();
    167   this->currentCampaign = NULL;
    168172}
    169173
Note: See TracChangeset for help on using the changeset viewer.