diff options
author | erihel <erihel@gmail.com> | 2012-09-22 00:11:16 +0200 |
---|---|---|
committer | erihel <erihel@gmail.com> | 2012-09-22 00:11:16 +0200 |
commit | 15ff1d512b9e103396144bec1cd8004ecf4f7f9c (patch) | |
tree | df57c12ca30d8691c40b7041a35c8deac253ad21 /src/app | |
parent | f5bc8e12d477a91c7d950675af81e074a94d6036 (diff) | |
download | colobot-15ff1d512b9e103396144bec1cd8004ecf4f7f9c.tar.gz colobot-15ff1d512b9e103396144bec1cd8004ecf4f7f9c.tar.bz2 colobot-15ff1d512b9e103396144bec1cd8004ecf4f7f9c.zip |
* Fixed audio problems
* Added colobot.ini to CApp in Create function
* Fixes to plugin manager
* Fixed CProfile segfault
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/app.cpp | 36 | ||||
-rw-r--r-- | src/app/app.h | 4 |
2 files changed, 36 insertions, 4 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp index 1da237e..73f7237 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -83,9 +83,11 @@ struct ApplicationPrivate CApplication::CApplication() { - m_private = new ApplicationPrivate(); - m_iMan = new CInstanceManager(); - m_eventQueue = new CEventQueue(m_iMan); + m_private = new ApplicationPrivate(); + m_iMan = new CInstanceManager(); + m_eventQueue = new CEventQueue(m_iMan); + m_pluginManager = new CPluginManager(); + m_profile = new CProfile(); m_engine = nullptr; m_device = nullptr; @@ -140,6 +142,12 @@ CApplication::~CApplication() delete m_eventQueue; m_eventQueue = nullptr; + delete m_pluginManager; + m_pluginManager = nullptr; + + delete m_profile; + m_profile = nullptr; + delete m_iMan; m_iMan = nullptr; @@ -302,8 +310,28 @@ bool CApplication::Create() m_deviceConfig.fullScreen = false; // Create the sound instance. - m_sound = new CSoundInterface(); + if (!GetProfile()->InitCurrentDirectory()) { + GetLogger()->Warn("Config not found. Default values will be used!\n"); + m_sound = new CSoundInterface(); + } else { + std::string path; + if (GetProfile()->GetLocalProfileString("Resources", "Data", path)) + m_dataPath = path; + + m_pluginManager->LoadFromProfile(); + m_sound = static_cast<CSoundInterface*>(CInstanceManager::GetInstancePointer()->SearchInstance(CLASS_SOUND)); + + if (!m_sound) { + GetLogger()->Error("Sound not loaded!\n"); + return false; + } + m_sound->Create(true); + if (GetProfile()->GetLocalProfileString("Resources", "Sound", path)) + m_sound->CacheAll(path); + else + m_sound->CacheAll(m_dataPath); + } std::string standardInfoMessage = "\nPlease see the console output or log file\n" diff --git a/src/app/app.h b/src/app/app.h index 03199aa..06879ae 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -30,6 +30,8 @@ #include "graphics/engine/engine.h" #include "graphics/opengl/gldevice.h" +#include "plugins/pluginmanager.h" + #include <string> #include <vector> @@ -331,6 +333,8 @@ protected: CSoundInterface* m_sound; //! Main class of the proper game engine CRobotMain* m_robotMain; + CPluginManager* m_pluginManager; + CProfile* m_profile; //! Code to return at exit int m_exitCode; |