forked from teamnwah/openmw-tes3coop
fixed overlay singleton
This commit is contained in:
parent
ba46bcad40
commit
8a05c0e5c0
4 changed files with 11 additions and 17 deletions
|
@ -20,7 +20,8 @@
|
||||||
#include "model/world/data.hpp"
|
#include "model/world/data.hpp"
|
||||||
|
|
||||||
CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
|
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)
|
mIpcServerName ("org.openmw.OpenCS"), mServer(NULL), mClientSocket(NULL)
|
||||||
{
|
{
|
||||||
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig();
|
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());
|
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
|
||||||
|
|
||||||
|
mOverlaySystem.reset (new CSVRender::OverlaySystem);
|
||||||
|
|
||||||
Bsa::registerResources (Files::Collections (config.first, !mFsStrict), config.second, true,
|
Bsa::registerResources (Files::Collections (config.first, !mFsStrict), config.second, true,
|
||||||
mFsStrict);
|
mFsStrict);
|
||||||
|
|
||||||
|
@ -66,9 +69,7 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
|
||||||
}
|
}
|
||||||
|
|
||||||
CS::Editor::~Editor ()
|
CS::Editor::~Editor ()
|
||||||
{
|
{}
|
||||||
CSVRender::OverlaySystem::instance().destroy(); // destruct before Ogre::Root
|
|
||||||
}
|
|
||||||
|
|
||||||
void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs)
|
void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace CS
|
||||||
Nif::Cache mNifCache;
|
Nif::Cache mNifCache;
|
||||||
Files::ConfigurationManager mCfgMgr;
|
Files::ConfigurationManager mCfgMgr;
|
||||||
CSMSettings::UserSettings mUserSettings;
|
CSMSettings::UserSettings mUserSettings;
|
||||||
CSVRender::OverlaySystem mOverlaySystem;
|
std::auto_ptr<CSVRender::OverlaySystem> mOverlaySystem;
|
||||||
CSMDoc::DocumentManager mDocumentManager;
|
CSMDoc::DocumentManager mDocumentManager;
|
||||||
CSVDoc::ViewManager mViewManager;
|
CSVDoc::ViewManager mViewManager;
|
||||||
CSVDoc::StartupDialogue mStartup;
|
CSVDoc::StartupDialogue mStartup;
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
#include "overlaysystem.hpp"
|
#include "overlaysystem.hpp"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include <OgreOverlaySystem.h>
|
#include <OgreOverlaySystem.h>
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
OverlaySystem *OverlaySystem::mOverlaySystemInstance = 0;
|
OverlaySystem *OverlaySystem::mOverlaySystemInstance = 0;
|
||||||
|
|
||||||
OverlaySystem::OverlaySystem() : mOverlaySystem(NULL)
|
OverlaySystem::OverlaySystem()
|
||||||
{
|
{
|
||||||
assert(!mOverlaySystemInstance);
|
assert(!mOverlaySystemInstance);
|
||||||
mOverlaySystemInstance = this;
|
mOverlaySystemInstance = this;
|
||||||
|
mOverlaySystem = new Ogre::OverlaySystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlaySystem::~OverlaySystem()
|
OverlaySystem::~OverlaySystem()
|
||||||
{
|
{
|
||||||
if(mOverlaySystem)
|
delete mOverlaySystem;
|
||||||
delete mOverlaySystem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlaySystem &OverlaySystem::instance()
|
OverlaySystem &OverlaySystem::instance()
|
||||||
|
@ -26,15 +28,7 @@ namespace CSVRender
|
||||||
|
|
||||||
Ogre::OverlaySystem *OverlaySystem::get()
|
Ogre::OverlaySystem *OverlaySystem::get()
|
||||||
{
|
{
|
||||||
if(!mOverlaySystem)
|
|
||||||
mOverlaySystem = new Ogre::OverlaySystem();
|
|
||||||
return mOverlaySystem;
|
return mOverlaySystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlaySystem::destroy()
|
|
||||||
{
|
|
||||||
delete mOverlaySystem;
|
|
||||||
mOverlaySystem = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace CSVRender
|
||||||
static OverlaySystem &instance();
|
static OverlaySystem &instance();
|
||||||
|
|
||||||
Ogre::OverlaySystem *get();
|
Ogre::OverlaySystem *get();
|
||||||
void destroy();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue