From 36db0e4cdbb116b9cadad1f1a946ebc161d689cd Mon Sep 17 00:00:00 2001 From: Karol Nowak Date: Sat, 5 Sep 2009 22:31:18 +0000 Subject: [PATCH] Fix bug #14239 - check for shrouded/fogged sound sources... ...in calculate_volume - that's the single point where it actually matters. --- changelog | 1 + src/soundsource.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index 096df7e2eae..05f71d037d8 100644 --- a/changelog +++ b/changelog @@ -10,6 +10,7 @@ Version 1.7.5+svn: * Updated translations: Czech, Estonian, French, Spanish. * Music and sound effects: * Added new music track, "Into the Shadows" by Tyler Johnson + * Fixed bug #14239 (check_fogged ignored by sound sources) * User interface: * new gamestate inspector debug dialog (via 'inspect' command and '[inspect]' tag) diff --git a/src/soundsource.cpp b/src/soundsource.cpp index 13a26531053..92ef6ccdc1a 100644 --- a/src/soundsource.cpp +++ b/src/soundsource.cpp @@ -189,9 +189,6 @@ void positional_source::update_positions(unsigned int time, const display &disp) 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))) - continue; - int v = calculate_volume(*i, disp); if(v < distance_volume) { distance_volume = v; @@ -210,6 +207,9 @@ int positional_source::calculate_volume(const map_location &loc, const display & assert(range_ > 0); assert(faderange_ > 0); + if(disp.shrouded(loc) || (check_fogged_ && disp.fogged(loc))) + return DISTANCE_SILENT; + SDL_Rect area = disp.map_area(); map_location center = disp.hex_clicked_on(area.x + area.w / 2, area.y + area.h / 2); size_t distance = distance_between(loc, center);