mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #504 from janisozaur/shadow-var
Prevent shadowing of global variable in function argument
This commit is contained in:
@@ -279,27 +279,27 @@ bool CSoundHandler::ambientCheckVisitable() const
|
|||||||
return !allTilesSource;
|
return !allTilesSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundHandler::ambientUpdateChannels(std::map<std::string, int> sounds)
|
void CSoundHandler::ambientUpdateChannels(std::map<std::string, int> soundsArg)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock guard(mutex);
|
boost::mutex::scoped_lock guard(mutex);
|
||||||
|
|
||||||
std::vector<std::string> stoppedSounds;
|
std::vector<std::string> stoppedSounds;
|
||||||
for(auto & pair : ambientChannels)
|
for(auto & pair : ambientChannels)
|
||||||
{
|
{
|
||||||
if(!vstd::contains(sounds, pair.first))
|
if(!vstd::contains(soundsArg, pair.first))
|
||||||
{
|
{
|
||||||
ambientStopSound(pair.first);
|
ambientStopSound(pair.first);
|
||||||
stoppedSounds.push_back(pair.first);
|
stoppedSounds.push_back(pair.first);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCS->soundh->setChannelVolume(pair.second, ambientDistToVolume(sounds[pair.first]));
|
CCS->soundh->setChannelVolume(pair.second, ambientDistToVolume(soundsArg[pair.first]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(auto soundId : stoppedSounds)
|
for(auto soundId : stoppedSounds)
|
||||||
ambientChannels.erase(soundId);
|
ambientChannels.erase(soundId);
|
||||||
|
|
||||||
for(auto & pair : sounds)
|
for(auto & pair : soundsArg)
|
||||||
{
|
{
|
||||||
if(!vstd::contains(ambientChannels, pair.first))
|
if(!vstd::contains(ambientChannels, pair.first))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user