summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-12-28 12:06:37 +0100
committerPiotr Dziwinski <piotrdz@gmail.com>2012-12-28 12:06:37 +0100
commit4cbb63f5b7824dc48e999401c625adb50075fdca (patch)
tree319fbae87e35045e043cd2fb54710490657a886d /src
parentb046c33206f3843164441c62d0bfab10725c8f28 (diff)
downloadcolobot-4cbb63f5b7824dc48e999401c625adb50075fdca.tar.gz
colobot-4cbb63f5b7824dc48e999401c625adb50075fdca.tar.bz2
colobot-4cbb63f5b7824dc48e999401c625adb50075fdca.zip
Fixed path for loading sounds
Diffstat (limited to 'src')
-rw-r--r--src/app/app.cpp33
-rw-r--r--src/app/app.h8
2 files changed, 23 insertions, 18 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();
}
diff --git a/src/app/app.h b/src/app/app.h
index 5bf6867..20d07df 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -285,11 +285,11 @@ public:
//! Returns the full path to data directory
std::string GetDataDirPath();
- //! Returns the full path to a file in data directory given standard dir and subpath
- std::string GetDataFilePath(DataDir dir, const std::string &subpath);
+ //! Returns the full path to a standard dir in data directory
+ std::string GetDataSubdirPath(DataDir stdDir);
- //! Returns the full path to a file in data directory given custom subpath in data dir
- std::string GetDataFilePath(const std::string &subpath);
+ //! Returns the full path to a file in data directory given standard dir and subpath
+ std::string GetDataFilePath(DataDir stdDir, const std::string &subpath);
//! Management of language
//@{