From 15ff1d512b9e103396144bec1cd8004ecf4f7f9c Mon Sep 17 00:00:00 2001 From: erihel Date: Sat, 22 Sep 2012 00:11:16 +0200 Subject: * Fixed audio problems * Added colobot.ini to CApp in Create function * Fixes to plugin manager * Fixed CProfile segfault --- src/app/app.cpp | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'src/app/app.cpp') 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(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" -- cgit v1.2.3-1-g7c22