Fix for correct music playing after dying in a different sector
authorTobias Markus <tobbi@mozilla-uk.org>
Tue, 17 Mar 2015 16:12:22 +0000 (17:12 +0100)
committerTobias Markus <tobbi@mozilla-uk.org>
Tue, 17 Mar 2015 16:12:22 +0000 (17:12 +0100)
src/audio/sound_manager.hpp
src/supertux/sector.cpp

index 7056b0d..102b0a8 100644 (file)
@@ -74,7 +74,9 @@ public:
   bool is_audio_enabled() {
     return device != 0 && context != 0;
   }
-
+  std::string get_current_music() const {
+    return current_music;
+  }
   void update();
 
   /*
index 146db5a..351fe31 100644 (file)
@@ -1500,7 +1500,14 @@ Sector::play_music(MusicType type)
 void
 Sector::resume_music()
 {
-  SoundManager::current()->resume_music(1.5f);
+  if(SoundManager::current()->get_current_music() == music)
+  {
+    SoundManager::current()->resume_music(1.5f);
+  }
+  else
+  {
+    SoundManager::current()->play_music(music, true);
+  }
 }
 
 MusicType