Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5894 for code/branches/core5


Ignore:
Timestamp:
Oct 6, 2009, 6:58:10 PM (15 years ago)
Author:
landauf
Message:

Using SmartPtr for CameraPositions in ControllableEntity.
This fixes a crash when finishing the pong level, because the static top-down camera was attached to the PongCenter and therefore destroyed before before the PongBat.

Location:
code/branches/core5/src/orxonox/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/orxonox/worldentities/ControllableEntity.cc

    r5846 r5894  
    104104                this->camera_->destroy();
    105105
    106             for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     106            for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    107107                (*it)->destroy();
    108108
     
    153153    {
    154154        unsigned int i = 0;
    155         for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     155        for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    156156        {
    157157            if (i == index)
     
    172172            else if (this->cameraPositions_.size() > 0)
    173173            {
    174                 for (std::list<CameraPosition*>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     174                for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    175175                {
    176176                    if ((*it) == this->camera_->getParent())
     
    333333        if (parent)
    334334        {
    335             for (std::list<CameraPosition*>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     335            for (std::list<SmartPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    336336                if ((*it)->getIsAbsolute())
    337337                    parent->attach((*it));
  • code/branches/core5/src/orxonox/worldentities/ControllableEntity.h

    r5738 r5894  
    104104            void addCameraPosition(CameraPosition* position);
    105105            CameraPosition* getCameraPosition(unsigned int index) const;
    106             inline const std::list<CameraPosition*>& getCameraPositions() const
     106            inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const
    107107                { return this->cameraPositions_; }
    108108
     
    198198            float mouseLookSpeed_;
    199199            Ogre::SceneNode* cameraPositionRootNode_;
    200             std::list<CameraPosition*> cameraPositions_;
     200            std::list<SmartPtr<CameraPosition> > cameraPositions_;
    201201            std::string cameraPositionTemplate_;
    202202            Controller* xmlcontroller_;
Note: See TracChangeset for help on using the changeset viewer.