Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 1, 2009, 11:44:53 AM (15 years ago)
Author:
rgrieder
Message:

Moved the singleton creation/destruction mess to the Core class by using just two possible Scopes:

  • ScopeID::Root for singletons that may always persists
  • ScopeID::Graphics for singletons that only work when graphics was loaded
File:
1 edited

Legend:

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

    r5842 r5850  
    4141#include "core/Game.h"
    4242#include "core/GameMode.h"
    43 #include "core/GraphicsManager.h"
    4443#include "core/GUIManager.h"
    4544#include "core/Loader.h"
    4645#include "core/XMLFile.h"
    4746
    48 #include "tools/interfaces/Tickable.h"
    49 #include "CameraManager.h"
    5047#include "LevelManager.h"
    5148#include "PlayerManager.h"
    52 #include "infos/HumanPlayer.h"
    5349
    5450namespace orxonox
     
    6561        , guiMouseOnlyInputState_(0)
    6662        , guiKeysOnlyInputState_(0)
    67         , cameraManager_(0)
    6863    {
    6964        RegisterObject(GSLevel);
     
    9893            guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
    9994            guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr());
    100 
    101             // create the global CameraManager
    102             this->cameraManager_ = new CameraManager(GraphicsManager::getInstance().getViewport());
    103         }
    104 
    105         this->playerManager_ = new PlayerManager();
    106 
    107         this->scope_GSLevel_ = new Scope<ScopeID::GSLevel>();
     95        }
    10896
    10997        if (GameMode::isMaster())
     
    126114           
    127115            // connect the HumanPlayer to the game
    128             this->playerManager_->clientConnected(0);
     116            PlayerManager::getInstance().clientConnected(0);
    129117        }
    130118    }
     
    165153        {
    166154            // disconnect the HumanPlayer
    167             this->playerManager_->clientDisconnected(0);
     155            PlayerManager::getInstance().clientDisconnected(0);
    168156           
    169157            // unload all compositors (this is only necessary because we don't yet destroy all resources!)
     
    184172        if (GameMode::isMaster())
    185173            this->unloadLevel();
    186 
    187         if (this->cameraManager_)
    188         {
    189             delete this->cameraManager_;
    190             this->cameraManager_ = 0;
    191         }
    192 
    193         if (this->playerManager_)
    194         {
    195             this->playerManager_->destroy();
    196             this->playerManager_ = 0;
    197         }
    198 
    199         if (this->scope_GSLevel_)
    200         {
    201             delete this->scope_GSLevel_;
    202             this->scope_GSLevel_ = NULL;
    203         }
    204174
    205175        if (GameMode::showsGraphics())
Note: See TracChangeset for help on using the changeset viewer.