diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-12-28 12:06:37 +0100 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-12-28 12:06:37 +0100 |
commit | 4cbb63f5b7824dc48e999401c625adb50075fdca (patch) | |
tree | 319fbae87e35045e043cd2fb54710490657a886d /src/app/app.cpp | |
parent | b046c33206f3843164441c62d0bfab10725c8f28 (diff) | |
download | colobot-4cbb63f5b7824dc48e999401c625adb50075fdca.tar.gz colobot-4cbb63f5b7824dc48e999401c625adb50075fdca.tar.bz2 colobot-4cbb63f5b7824dc48e999401c625adb50075fdca.zip |
Fixed path for loading sounds
Diffstat (limited to 'src/app/app.cpp')
-rw-r--r-- | src/app/app.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp index 27adcb1..4d32de3 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -329,26 +329,29 @@ bool CApplication::Create() GetLogger()->Debug("Testing gettext translation: '%s'\n", gettext("Colobot rules!")); //Create the sound instance. - if (!GetProfile().InitCurrentDirectory()) { + if (!GetProfile().InitCurrentDirectory()) + { GetLogger()->Warn("Config not found. Default values will be used!\n"); m_sound = new CSoundInterface(); - } else { + } + else + { std::string path; if (GetProfile().GetLocalProfileString("Resources", "Data", path)) m_dataPath = path; - #ifdef OPENAL_SOUND - m_sound = static_cast<CSoundInterface *>(new ALSound()); - #else - GetLogger()->Info("No sound support.\n"); - m_sound = new CSoundInterface(); - #endif + #ifdef OPENAL_SOUND + m_sound = static_cast<CSoundInterface *>(new ALSound()); + #else + GetLogger()->Info("No sound support.\n"); + m_sound = new CSoundInterface(); + #endif m_sound->Create(true); if (GetProfile().GetLocalProfileString("Resources", "Sound", path)) m_sound->CacheAll(path); else - m_sound->CacheAll(m_dataPath); + m_sound->CacheAll(GetDataSubdirPath(DIR_SOUND)); } std::string standardInfoMessage = @@ -1421,24 +1424,26 @@ std::string CApplication::GetDataDirPath() return m_dataPath; } -std::string CApplication::GetDataFilePath(DataDir dataDir, const std::string& subpath) +std::string CApplication::GetDataSubdirPath(DataDir stdDir) { - int index = static_cast<int>(dataDir); + int index = static_cast<int>(stdDir); assert(index >= 0 && index < DIR_MAX); std::stringstream str; str << m_dataPath; str << "/"; str << m_dataDirs[index]; - str << "/"; - str << subpath; return str.str(); } -std::string CApplication::GetDataFilePath(const std::string& subpath) +std::string CApplication::GetDataFilePath(DataDir stdDir, const std::string& subpath) { + int index = static_cast<int>(stdDir); + assert(index >= 0 && index < DIR_MAX); std::stringstream str; str << m_dataPath; str << "/"; + str << m_dataDirs[index]; + str << "/"; str << subpath; return str.str(); } |