This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit 7b04f673580f0c24aecc103a25c4c4b82da1380f
Author: krzys-h <krzy...@interia.pl>
Date:   Thu Jul 10 15:38:37 2014 +0200

    Fixed music loading
---
 src/sound/oalsound/alsound.cpp | 20 ++++++++++----------
 src/sound/sound.cpp            |  8 ++++----
 src/ui/maindialog.cpp          |  7 +++----
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index e9bc116..54c94a5 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -173,12 +173,12 @@ bool ALSound::Cache(Sound sound, const std::string 
&filename)
 
 bool ALSound::CacheMusic(const std::string &filename)
 {
-    if (m_music.find(filename) == m_music.end())
+    if (m_music.find("music/"+filename) == m_music.end())
     {
         Buffer *buffer = new Buffer();
-        if (buffer->LoadFromFile(filename, static_cast<Sound>(-1)))
+        if (buffer->LoadFromFile("music/"+filename, static_cast<Sound>(-1)))
         {
-            m_music[filename] = buffer;
+            m_music["music/"+filename] = buffer;
             return true;
         }
     }
@@ -609,7 +609,7 @@ void ALSound::SetListener(const Math::Vector &eye, const 
Math::Vector &lookat)
 bool ALSound::PlayMusic(int rank, bool bRepeat, float fadeTime)
 {
     std::stringstream filename;
-    filename << "music/music" << std::setfill('0') << std::setw(3) << rank << 
".ogg";
+    filename << "music" << std::setfill('0') << std::setw(3) << rank << ".ogg";
     return PlayMusic(filename.str(), bRepeat, fadeTime);
 }
 
@@ -636,26 +636,26 @@ bool ALSound::PlayMusic(const std::string &filename, bool 
bRepeat, float fadeTim
     Buffer *buffer;
 
     // check if we have music in cache
-    if (m_music.find(filename) == m_music.end())
+    if (m_music.find("music/"+filename) == m_music.end())
     {
         GetLogger()->Debug("Music %s was not cached!\n", filename.c_str());
-        if (!boost::filesystem::exists(filename))
+        /* TODO: if (!boost::filesystem::exists("music/"+filename))
         {
             GetLogger()->Debug("Requested music %s was not found.\n", 
filename.c_str());
             return false;
-        }
+        } */
 
         buffer = new Buffer();
-        if (!buffer->LoadFromFile(filename, static_cast<Sound>(-1)))
+        if (!buffer->LoadFromFile("music/"+filename, static_cast<Sound>(-1)))
         {
             return false;
         }
-        m_music[filename] = buffer;
+        m_music["music/"+filename] = buffer;
     }
     else
     {
         GetLogger()->Debug("Music loaded from cache\n");
-        buffer = m_music[filename];
+        buffer = m_music["music/"+filename];
     }
 
     if (m_currentMusic)
diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp
index 9c9f483..5d99cdb 100644
--- a/src/sound/sound.cpp
+++ b/src/sound/sound.cpp
@@ -54,10 +54,10 @@ void CSoundInterface::CacheAll()
 
 void CSoundInterface::AddMusicFiles()
 {
-    CacheMusic("music/Intro1.ogg");
-    CacheMusic("music/Intro2.ogg");
-    CacheMusic("music/music010.ogg");
-    CacheMusic("music/music011.ogg");
+    CacheMusic("Intro1.ogg");
+    CacheMusic("Intro2.ogg");
+    CacheMusic("music010.ogg");
+    CacheMusic("music011.ogg");
 }
 
 bool CSoundInterface::Cache(Sound bSound, const std::string &bFile)
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index c6322b6..2699b46 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -764,7 +764,7 @@ pb->SetState(STATE_SHADOW);
     {
         if (!m_sound->IsPlayingMusic())
         {
-            m_sound->PlayMusic("music/Intro1.ogg", false);
+            m_sound->PlayMusic("Intro1.ogg", false);
         }
     }
 
@@ -2013,7 +2013,7 @@ bool CMainDialog::EventProcess(const Event &event)
         {
             if (!m_sound->IsPlayingMusic())
             {
-                m_sound->PlayMusic("music/Intro2.ogg", true);
+                m_sound->PlayMusic("Intro2.ogg", true);
             }
         }
 
@@ -3579,7 +3579,7 @@ void CMainDialog::SetUserDir(char *base, int rank)
 
 void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank)
 {
-    //TODO: Support for more than 100
+    //TODO: Support for more than 9 chapters
     int chapter = rank/100;
     int new_rank = rank%100;
     
@@ -3614,7 +3614,6 @@ void CMainDialog::BuildSceneName(std::string &filename, 
char *base, int rank)
             outstream << "scene.txt";
         }
         filename = outstream.str();
-        std::cout << filename.c_str() << std::endl;
     }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/colobot.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to