mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
fixed exception handling during subsystem setup
This commit is contained in:
parent
1149e282b8
commit
e26f39e563
4 changed files with 44 additions and 9 deletions
|
@ -158,13 +158,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
|
|
||||||
OMW::Engine::~Engine()
|
OMW::Engine::~Engine()
|
||||||
{
|
{
|
||||||
delete MWBase::Environment::get().getInputManager();
|
mEnvironment.cleanup();
|
||||||
delete MWBase::Environment::get().getSoundManager();
|
|
||||||
delete MWBase::Environment::get().getMechanicsManager();
|
|
||||||
delete MWBase::Environment::get().getDialogueManager();
|
|
||||||
delete MWBase::Environment::get().getJournal();
|
|
||||||
delete MWBase::Environment::get().getScriptManager();
|
|
||||||
delete MWBase::Environment::get().getWorld();
|
|
||||||
delete mScriptContext;
|
delete mScriptContext;
|
||||||
delete mOgre;
|
delete mOgre;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace OMW
|
||||||
/// \brief Main engine class, that brings together all the components of OpenMW
|
/// \brief Main engine class, that brings together all the components of OpenMW
|
||||||
class Engine : private Ogre::FrameListener
|
class Engine : private Ogre::FrameListener
|
||||||
{
|
{
|
||||||
|
MWBase::Environment mEnvironment;
|
||||||
std::string mEncoding;
|
std::string mEncoding;
|
||||||
Files::PathContainer mDataDirs;
|
Files::PathContainer mDataDirs;
|
||||||
boost::filesystem::path mResDir;
|
boost::filesystem::path mResDir;
|
||||||
|
@ -77,7 +78,6 @@ namespace OMW
|
||||||
std::string mFocusName;
|
std::string mFocusName;
|
||||||
std::map<std::string,std::string> mFallbackMap;
|
std::map<std::string,std::string> mFallbackMap;
|
||||||
|
|
||||||
MWBase::Environment mEnvironment;
|
|
||||||
Compiler::Extensions mExtensions;
|
Compiler::Extensions mExtensions;
|
||||||
Compiler::Context *mScriptContext;
|
Compiler::Context *mScriptContext;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,19 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "../mwinput/inputmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwscript/scriptmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwdialogue/dialoguemanager.hpp"
|
||||||
|
#include "../mwdialogue/journal.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||||
|
|
||||||
MWBase::Environment::Environment()
|
MWBase::Environment::Environment()
|
||||||
|
@ -15,6 +28,7 @@ MWBase::Environment::Environment()
|
||||||
|
|
||||||
MWBase::Environment::~Environment()
|
MWBase::Environment::~Environment()
|
||||||
{
|
{
|
||||||
|
cleanup();
|
||||||
sThis = 0;
|
sThis = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +130,30 @@ float MWBase::Environment::getFrameDuration() const
|
||||||
return mFrameDuration;
|
return mFrameDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MWBase::Environment::cleanup()
|
||||||
|
{
|
||||||
|
delete mInputManager;
|
||||||
|
mInputManager = 0;
|
||||||
|
|
||||||
|
delete mSoundManager;
|
||||||
|
mSoundManager = 0;
|
||||||
|
|
||||||
|
delete mMechanicsManager;
|
||||||
|
mMechanicsManager = 0;
|
||||||
|
|
||||||
|
delete mDialogueManager;
|
||||||
|
mDialogueManager = 0;
|
||||||
|
|
||||||
|
delete mJournal;
|
||||||
|
mJournal = 0;
|
||||||
|
|
||||||
|
delete mScriptManager;
|
||||||
|
mScriptManager = 0;
|
||||||
|
|
||||||
|
delete mWorld;
|
||||||
|
mWorld = 0;
|
||||||
|
}
|
||||||
|
|
||||||
const MWBase::Environment& MWBase::Environment::get()
|
const MWBase::Environment& MWBase::Environment::get()
|
||||||
{
|
{
|
||||||
assert (sThis);
|
assert (sThis);
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace MWBase
|
||||||
///
|
///
|
||||||
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
|
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
|
||||||
///
|
///
|
||||||
/// \attention Environment does not take ownership of the manager class instances it is handed over in
|
/// \attention Environment takes ownership of the manager class instances it is handed over in
|
||||||
/// the set* functions.
|
/// the set* functions.
|
||||||
class Environment
|
class Environment
|
||||||
{
|
{
|
||||||
|
@ -108,6 +108,9 @@ namespace MWBase
|
||||||
|
|
||||||
float getFrameDuration() const;
|
float getFrameDuration() const;
|
||||||
|
|
||||||
|
void cleanup();
|
||||||
|
///< Delete all mw*-subsystems.
|
||||||
|
|
||||||
static const Environment& get();
|
static const Environment& get();
|
||||||
///< Return instance of this class.
|
///< Return instance of this class.
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue