Skip to content

Commit

Permalink
check lobby_sounds preference for the GUI 1 lobby also
Browse files Browse the repository at this point in the history
This fixes a bug reported on forums here:
http://forums.wesnoth.org/viewtopic.php?f=4&t=40660#p572131

The lobby sounds pref now affects the GUI 1 and 2 mp lobbies,
but it only affects the lobby screen, not mp::wait or mp::connect
etc.

This check is implemented by trying to dynamic cast 'this' mp::ui
object to a mp::lobby, at the time when we would play the arrive
or leave sounds.

The lobby sounds pref does *not* block the sounds due to server
messages, messages from a friend, or whispers.
  • Loading branch information
cbeck88 committed Jul 14, 2014
1 parent edaafcb commit e28bda2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/multiplayer_ui.cpp
Expand Up @@ -25,6 +25,7 @@
#include "menu_events.hpp"
#include "multiplayer.hpp"
#include "multiplayer_ui.hpp"
#include "multiplayer_lobby.hpp" //needed for dynamic cast when implementing the lobby_sounds preference
#include "sound.hpp"
#include "wml_separators.hpp"
#include "formula_string_utils.hpp"
Expand Down Expand Up @@ -689,7 +690,7 @@ void ui::set_user_menu_items(const std::vector<std::string>& list)

void ui::set_user_list(const std::vector<std::string>& list, bool silent)
{
if(!silent) {
if(!silent && (!dynamic_cast<mp::lobby*>(this) || preferences::lobby_sounds())) {
if(list.size() < user_list_.size()) {
sound::play_UI_sound(game_config::sounds::user_leave);
} else if(list.size() > user_list_.size()) {
Expand Down

0 comments on commit e28bda2

Please sign in to comment.