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).

Location:
code/branches/core5/src/orxonox
Files:
2 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        }
  • code/branches/core5/src/orxonox/graphics/Camera.cc

    r5924 r5925  
    3838#include "core/CoreIncludes.h"
    3939#include "core/ConfigValueIncludes.h"
     40#include "core/GameMode.h"
    4041#include "core/GUIManager.h"
    4142#include "Scene.h"
     
    5051        RegisterObject(Camera);
    5152
     53        if (!GameMode::showsGraphics())
     54            ThrowException(AbortLoading, "Can't create Camera, no graphics.");
    5255        if (!this->getScene())
    5356            ThrowException(AbortLoading, "Can't create Camera, no scene.");
     
    7679        if (this->isInitialized())
    7780        {
    78             if( GUIManager::getInstance().getCamera() == this->camera_ )
    79                 GUIManager::getInstance().setCamera( NULL );
     81            if (GUIManager::getInstance().getCamera() == this->camera_)
     82                GUIManager::getInstance().setCamera(NULL);
    8083            this->releaseFocus();
    8184
Note: See TracChangeset for help on using the changeset viewer.