From: Ondřej Hošek Date: Tue, 25 Oct 2005 19:40:57 +0000 (+0000) Subject: Fixed flame-caused segfault when sound is off X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d308531497614f98b4e63de0095e6ddc37f7706e;p=supertux.git Fixed flame-caused segfault when sound is off SVN-Revision: 2917 --- diff --git a/src/audio/sound_manager.hpp b/src/audio/sound_manager.hpp index 5415b7055..b39162bb4 100644 --- a/src/audio/sound_manager.hpp +++ b/src/audio/sound_manager.hpp @@ -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(); diff --git a/src/badguy/flame.cpp b/src/badguy/flame.cpp index f43b69a05..1c03b3595 100644 --- a/src/badguy/flame.cpp +++ b/src/badguy/flame.cpp @@ -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) {