mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 18:46:19 +00:00
Don't update volume of global sound sources when scrolling.
This commit is contained in:
parent
9d2dd5f362
commit
b1f514e47a
@ -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<map_location>::iterator i = locations_.begin(); i != locations_.end(); ++i) {
|
||||
if(disp.shrouded(*i) || (check_fogged_ && disp.fogged(*i)))
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user