mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 09:13:35 +00:00
use different join/leave sounds for the game lobby
This commit is contained in:
parent
31bb485002
commit
1be058cfce
@ -106,7 +106,9 @@ namespace game_config
|
||||
receive_message_friend = "chat-friend.ogg",
|
||||
receive_message_server = "receive.wav",
|
||||
user_arrive = "arrive.wav",
|
||||
user_leave = "leave.wav";
|
||||
user_leave = "leave.wav",
|
||||
game_user_arrive = "join.wav",
|
||||
game_user_leave = "leave.wav";
|
||||
|
||||
const std::string button_press = "button.wav",
|
||||
checkbox_release = "checkbox.wav",
|
||||
|
@ -88,7 +88,8 @@ namespace game_config
|
||||
namespace sounds {
|
||||
extern const std::string turn_bell, timer_bell, receive_message,
|
||||
receive_message_highlight, receive_message_friend,
|
||||
receive_message_server, user_arrive, user_leave;
|
||||
receive_message_server, user_arrive, user_leave,
|
||||
game_user_arrive, game_user_leave;
|
||||
extern const std::string button_press, checkbox_release, slider_adjust,
|
||||
menu_expand, menu_contract, menu_select;
|
||||
}
|
||||
|
@ -974,11 +974,9 @@ connect::connect(game_display& disp, const config& game_config, const game_data&
|
||||
if (side_choice != -1)
|
||||
sides_[side_choice].set_id(preferences::login());
|
||||
|
||||
update_playerlist_state();
|
||||
|
||||
// Updates the "level_" variable, now that sides are loaded
|
||||
update_level();
|
||||
gamelist_updated(true);
|
||||
update_playerlist_state(true);
|
||||
|
||||
// If we are connected, send data to the connected host
|
||||
network::send_data(level_, 0, true);
|
||||
@ -1074,11 +1072,6 @@ void connect::hide_children(bool hide)
|
||||
cancel_.hide(hide);
|
||||
}
|
||||
|
||||
void connect::gamelist_updated(bool silent)
|
||||
{
|
||||
update_playerlist_state(silent);
|
||||
}
|
||||
|
||||
void connect::process_network_data(const config& data, const network::connection sock)
|
||||
{
|
||||
ui::process_network_data(data, sock);
|
||||
@ -1639,7 +1632,7 @@ void connect::update_playerlist_state(bool silent)
|
||||
++itor) {
|
||||
playerlist.push_back(itor->name);
|
||||
}
|
||||
set_user_list(playerlist, silent);
|
||||
set_user_list(playerlist, silent, true);
|
||||
set_user_menu_items(playerlist);
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ protected:
|
||||
|
||||
virtual void hide_children(bool hide=true);
|
||||
|
||||
virtual void gamelist_updated(bool silent=true);
|
||||
private:
|
||||
// Those 2 functions are actually the steps of the (complex)
|
||||
// construction of this class.
|
||||
|
@ -675,13 +675,15 @@ void ui::set_user_menu_items(const std::vector<std::string>& list)
|
||||
users_menu_.set_items(list,true,true);
|
||||
}
|
||||
|
||||
void ui::set_user_list(const std::vector<std::string>& list, bool silent)
|
||||
void ui::set_user_list(const std::vector<std::string>& list, bool silent, bool game)
|
||||
{
|
||||
if(!silent) {
|
||||
if(list.size() < user_list_.size()) {
|
||||
sound::play_UI_sound(game_config::sounds::user_leave);
|
||||
if (game) sound::play_UI_sound(game_config::sounds::game_user_leave);
|
||||
else sound::play_UI_sound(game_config::sounds::user_leave);
|
||||
} else if(list.size() > user_list_.size()) {
|
||||
sound::play_UI_sound(game_config::sounds::user_arrive);
|
||||
if (game) sound::play_UI_sound(game_config::sounds::game_user_arrive);
|
||||
else sound::play_UI_sound(game_config::sounds::user_arrive);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ protected:
|
||||
virtual void gamelist_updated(bool silent=true);
|
||||
|
||||
// Sets the user list
|
||||
void set_user_list(const std::vector<std::string>&, bool silent);
|
||||
void set_user_list(const std::vector<std::string>&, bool silent, bool game=false);
|
||||
void set_user_menu_items(const std::vector<std::string>& list);
|
||||
|
||||
// Returns the current gamelist
|
||||
|
@ -544,7 +544,7 @@ void wait::generate_menu()
|
||||
// Uses the actual connected player list if we do not have any
|
||||
// "gamelist" user data
|
||||
if (gamelist().child("user") == NULL) {
|
||||
set_user_list(playerlist, true);
|
||||
set_user_list(playerlist, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user