Fixed flame-caused segfault when sound is off
authorOndřej Hošek <ondra.hosek@gmail.com>
Tue, 25 Oct 2005 19:40:57 +0000 (19:40 +0000)
committerOndřej Hošek <ondra.hosek@gmail.com>
Tue, 25 Oct 2005 19:40:57 +0000 (19:40 +0000)
SVN-Revision: 2917

src/audio/sound_manager.hpp
src/badguy/flame.cpp

index 5415b70..b39162b 100644 (file)
@@ -41,6 +41,8 @@ public:
   void enable_music(bool music_enabled);
   void play_music(const std::string& filename, bool fade = false);
   void stop_music(bool fade = true);
+  
+  bool is_sound_enabled() { return sound_enabled; }
 
   void update();
 
index f43b69a..1c03b35 100644 (file)
@@ -62,12 +62,16 @@ Flame::active_update(float elapsed_time)
                 start_position.y + sin(angle) * radius);
   movement = newpos - get_pos();
 
-  source->set_position(get_pos());
+  if (sound_manager->is_sound_enabled())
+    source->set_position(get_pos());
 }
 
 void
 Flame::activate()
 {
+  if (!sound_manager->is_sound_enabled())
+    return;
+
   delete source;
   source = sound_manager->create_sound_source("sounds/flame.wav");
   if(!source) {