Made CPauseManager not a singleton

master
krzys-h 2015-08-31 22:05:21 +02:00
parent 75d18ced05
commit c3d7876a5c
8 changed files with 13 additions and 11 deletions

View File

@ -28,9 +28,6 @@
#include <algorithm>
template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr;
CPauseManager::CPauseManager()
{}

View File

@ -23,8 +23,6 @@
*/
#pragma once
#include "common/singleton.h"
#include <string>
#include <vector>
#include <memory>
@ -59,7 +57,7 @@ private:
PauseType type;
};
class CPauseManager : public CSingleton<CPauseManager>
class CPauseManager
{
public:
CPauseManager();

View File

@ -270,6 +270,11 @@ CCloud* CEngine::GetCloud()
return m_cloud.get();
}
CPauseManager* CEngine::GetPauseManager()
{
return m_pause.get();
}
void CEngine::SetTerrain(CTerrain* terrain)
{
m_terrain = terrain;

View File

@ -646,6 +646,8 @@ public:
CPlanet* GetPlanet();
//! Returns the fog manager
CCloud* GetCloud();
//! Returns the pause manager
CPauseManager* GetPauseManager();
//! Sets the terrain object
void SetTerrain(CTerrain* terrain);

View File

@ -135,7 +135,7 @@ CRobotMain::CRobotMain()
m_cloud = m_engine->GetCloud();
m_lightning = m_engine->GetLightning();
m_planet = m_engine->GetPlanet();
m_pause = CPauseManager::GetInstancePointer();
m_pause = m_engine->GetPauseManager();
m_input = CInput::GetInstancePointer();
m_modelManager = MakeUnique<Gfx::CModelManager>();

View File

@ -69,7 +69,7 @@ CDisplayInfo::CDisplayInfo()
m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera();
m_pause = CPauseManager::GetInstancePointer();
m_pause = m_engine->GetPauseManager();
m_bInfoMaximized = true;
m_bInfoMinimized = false;

View File

@ -113,9 +113,9 @@ bool CMainShort::CreateShortcuts()
{
return true;
}
CPauseManager* pause = CPauseManager::GetInstancePointer();
PauseType pauseType = m_engine->GetPauseManager()->GetPauseType();
if (pause->GetPauseType() == PAUSE_SATCOM || pause->GetPauseType() == PAUSE_EDITOR || pause->GetPauseType() == PAUSE_DIALOG)
if (pauseType == PAUSE_SATCOM || pauseType == PAUSE_EDITOR || pauseType == PAUSE_DIALOG)
return true;
// Create new shortcuts

View File

@ -80,7 +80,7 @@ CStudio::CStudio()
m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera();
m_pause = CPauseManager::GetInstancePointer();
m_pause = m_engine->GetPauseManager();
m_settings = CSettings::GetInstancePointer();
m_program = nullptr;