Fix bug #14239 - check for shrouded/fogged sound sources...

...in calculate_volume - that's the single point where it actually matters.
This commit is contained in:
Karol Nowak 2009-09-05 22:31:18 +00:00
parent 7d2d62cb33
commit 36db0e4cdb
2 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -189,9 +189,6 @@ void positional_source::update_positions(unsigned int time, const display &disp)
int distance_volume = DISTANCE_SILENT;
for(std::vector<map_location>::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);