From b1f514e47a12e88981e676a51b23e79236aaf28e Mon Sep 17 00:00:00 2001 From: Karol Nowak Date: Sat, 11 Jul 2009 21:41:35 +0000 Subject: [PATCH] Don't update volume of global sound sources when scrolling. --- src/soundsource.cpp | 9 +++++++++ src/soundsource.hpp | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/soundsource.cpp b/src/soundsource.cpp index ab749385110..42674072d8a 100644 --- a/src/soundsource.cpp +++ b/src/soundsource.cpp @@ -145,6 +145,11 @@ positional_source::~positional_source() sound::reposition_sound(id_, DISTANCE_SILENT); } +bool positional_source::is_global() +{ + return locations_.empty(); +} + void positional_source::update(unsigned int time, const display &disp) { if(time - last_played_ < min_delay_ || sound::is_sound_playing(id_)) @@ -179,6 +184,10 @@ void positional_source::update(unsigned int time, const display &disp) void positional_source::update_positions(unsigned int time, const display &disp) { + if(is_global()) { + return; + } + int distance_volume = DISTANCE_SILENT; for(std::vector::iterator i = locations_.begin(); i != locations_.end(); ++i) { if(disp.shrouded(*i) || (check_fogged_ && disp.fogged(*i))) diff --git a/src/soundsource.hpp b/src/soundsource.hpp index 94962d36a93..72baf6ab277 100644 --- a/src/soundsource.hpp +++ b/src/soundsource.hpp @@ -52,7 +52,6 @@ class positional_source { static unsigned int last_id; public: - // min_delay is a minimum time in seconds, which must pass before // this sound source can be played again if it remains visible // @@ -62,6 +61,8 @@ public: positional_source(const sourcespec &spec); ~positional_source(); + bool is_global(); + void update(unsigned int time, const display &disp); void update_positions(unsigned int time, const display &disp);