diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp index a399a8146..c5177c083 100644 --- a/src/network/protocols/client_lobby.cpp +++ b/src/network/protocols/client_lobby.cpp @@ -676,6 +676,7 @@ void ClientLobby::updatePlayerList(Event* event) unsigned player_count = data.getUInt8(); std::vector > players; + core::stringw total_players; for (unsigned i = 0; i < player_count; i++) { std::tuple(pl) = data.getUInt32(); std::get<2>(pl) = data.getUInt8(); data.decodeStringW(&std::get<3>(pl)); + total_players += std::get<3>(pl); bool is_peer_waiting_for_game = data.getUInt8() == 1; bool is_peer_server_owner = data.getUInt8() == 1; // icon to be used, see NetworkingLobby::loadedFromFile @@ -697,6 +699,13 @@ void ClientLobby::updatePlayerList(Event* event) std::get<5>(pl) = (KartTeam)data.getUInt8(); players.push_back(pl); } + + // Notification sound for new player + if (!m_total_players.empty() && + total_players.size() > m_total_players.size()) + SFXManager::get()->quickSound("energy_bar_full"); + m_total_players = total_players; + NetworkingLobby::getInstance()->updatePlayers(players); } // updatePlayerList diff --git a/src/network/protocols/client_lobby.hpp b/src/network/protocols/client_lobby.hpp index 3a56403f4..3d5a034a6 100644 --- a/src/network/protocols/client_lobby.hpp +++ b/src/network/protocols/client_lobby.hpp @@ -87,6 +87,8 @@ private: std::map m_disconnected_msg; + irr::core::stringw m_total_players; + public: ClientLobby(const TransportAddress& a, std::shared_ptr s); virtual ~ClientLobby();