Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 9, 2009, 6:46:54 PM (15 years ago)
Author:
rgrieder
Message:

Reapplied some of the changes that got reverted in the last commit (including two fixes).

File:
1 edited

Legend:

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

    r5924 r5925  
    5151        : viewport_(GraphicsManager::getInstance().getViewport())
    5252    {
     53        assert(GameMode::showsGraphics());
    5354    }
    5455
     
    6061    Camera* CameraManager::getActiveCamera() const
    6162    {
    62         if (this->cameraList_.size() > 0)
     63        if (!this->cameraList_.empty())
    6364            return this->cameraList_.front();
    6465        else
     
    6869    void CameraManager::requestFocus(Camera* camera)
    6970    {
    70         if (!GameMode::showsGraphics())
    71             assert(0);
    72 
    7371        // notify old camera (if it exists)
    74         if (this->cameraList_.size() > 0)
     72        if (!this->cameraList_.empty())
    7573            this->cameraList_.front()->removeFocus();
    7674
     
    7876
    7977        // make sure we don't add it twice
    80         for (std::list<Camera*>::iterator it = this->cameraList_.begin(); it != this->cameraList_.end(); ++it)
     78        for (std::list<Camera*>::iterator it = this->cameraList_.begin(); it != this->cameraList_.end();)
    8179            if ((*it) == camera)
    82                 return;
    83 
     80                this->cameraList_.erase(it++);
     81            else
     82                ++it;
    8483        // add to list
    8584        this->cameraList_.push_front(camera);
     
    8887    void CameraManager::releaseFocus(Camera* camera)
    8988    {
    90         if (!GameMode::showsGraphics())
    91             assert(0);
    92 
    9389        // notify the cam of releasing the focus
    9490        if (!this->cameraList_.empty() && this->cameraList_.front() == camera)
     
    9894
    9995            // set new focus if possible
    100             if (this->cameraList_.size() > 0)
     96            if (!this->cameraList_.empty())
    10197                this->cameraList_.front()->setFocus();
    10298        }
Note: See TracChangeset for help on using the changeset viewer.