1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 13:12:50 +00:00

fixed overlay singleton

This commit is contained in:
Marc Zinnschlag 2014-10-17 14:23:27 +02:00
parent ba46bcad40
commit 8a05c0e5c0
4 changed files with 11 additions and 17 deletions

View File

@ -20,7 +20,8 @@
#include "model/world/data.hpp"
CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
: mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager),
: mUserSettings (mCfgMgr), mOverlaySystem (0), mDocumentManager (mCfgMgr),
mViewManager (mDocumentManager),
mIpcServerName ("org.openmw.OpenCS"), mServer(NULL), mClientSocket(NULL)
{
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig();
@ -32,6 +33,8 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
mOverlaySystem.reset (new CSVRender::OverlaySystem);
Bsa::registerResources (Files::Collections (config.first, !mFsStrict), config.second, true,
mFsStrict);
@ -66,9 +69,7 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
}
CS::Editor::~Editor ()
{
CSVRender::OverlaySystem::instance().destroy(); // destruct before Ogre::Root
}
{}
void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs)
{

View File

@ -43,7 +43,7 @@ namespace CS
Nif::Cache mNifCache;
Files::ConfigurationManager mCfgMgr;
CSMSettings::UserSettings mUserSettings;
CSVRender::OverlaySystem mOverlaySystem;
std::auto_ptr<CSVRender::OverlaySystem> mOverlaySystem;
CSMDoc::DocumentManager mDocumentManager;
CSVDoc::ViewManager mViewManager;
CSVDoc::StartupDialogue mStartup;

View File

@ -1,21 +1,23 @@
#include "overlaysystem.hpp"
#include <cassert>
#include <OgreOverlaySystem.h>
namespace CSVRender
{
OverlaySystem *OverlaySystem::mOverlaySystemInstance = 0;
OverlaySystem::OverlaySystem() : mOverlaySystem(NULL)
OverlaySystem::OverlaySystem()
{
assert(!mOverlaySystemInstance);
mOverlaySystemInstance = this;
mOverlaySystem = new Ogre::OverlaySystem();
}
OverlaySystem::~OverlaySystem()
{
if(mOverlaySystem)
delete mOverlaySystem;
delete mOverlaySystem;
}
OverlaySystem &OverlaySystem::instance()
@ -26,15 +28,7 @@ namespace CSVRender
Ogre::OverlaySystem *OverlaySystem::get()
{
if(!mOverlaySystem)
mOverlaySystem = new Ogre::OverlaySystem();
return mOverlaySystem;
}
void OverlaySystem::destroy()
{
delete mOverlaySystem;
mOverlaySystem = NULL;
}
}

View File

@ -20,7 +20,6 @@ namespace CSVRender
static OverlaySystem &instance();
Ogre::OverlaySystem *get();
void destroy();
};
}