fix music not playing again after disable&enabling it
authorMatthias Braun <matze@braunis.de>
Wed, 11 Jan 2006 23:38:48 +0000 (23:38 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 11 Jan 2006 23:38:48 +0000 (23:38 +0000)
SVN-Revision: 2986

src/audio/sound_manager.cpp

index 963ce94..1490768 100644 (file)
@@ -167,12 +167,18 @@ SoundManager::stop_music(bool fade)
 void
 SoundManager::play_music(const std::string& filename, bool fade)
 {
-  if(filename == current_music)
+  if(filename == current_music && music_source != NULL)
     return;
   current_music = filename;
   if(!music_enabled)
     return;
 
+  if(filename == "") {
+    delete music_source;
+    music_source = 0;
+    return;
+  }
+
   try {
     std::auto_ptr<StreamSoundSource> newmusic (new StreamSoundSource());
     alSourcef(newmusic->source, AL_ROLLOFF_FACTOR, 0);