mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 20:37:38 +00:00
GCC I've come to bargain
This commit is contained in:
parent
2f9449edec
commit
ff11c846b8
@ -110,8 +110,8 @@ void room_info::process_room_members(const config& data)
|
||||
user_info::user_info(const config& c)
|
||||
: name(c["name"])
|
||||
, game_id(c["game_id"])
|
||||
, relation(relation::ME)
|
||||
, state(game_id == 0 ? state::LOBBY : state::GAME)
|
||||
, relation(user_relation::ME)
|
||||
, state(game_id == 0 ? user_state::LOBBY : user_state::GAME)
|
||||
, registered(c["registered"].to_bool())
|
||||
, observing(c["status"] == "observing")
|
||||
, moderator(c["moderator"].to_bool(false))
|
||||
@ -124,15 +124,15 @@ void user_info::update_state(int selected_game_id,
|
||||
{
|
||||
if(game_id != 0) {
|
||||
if(game_id == selected_game_id) {
|
||||
state = state::SEL_GAME;
|
||||
state = user_state::SEL_GAME;
|
||||
} else {
|
||||
state = state::GAME;
|
||||
state = user_state::GAME;
|
||||
}
|
||||
} else {
|
||||
if(current_room != nullptr && current_room->is_member(name)) {
|
||||
state = state::SEL_ROOM;
|
||||
state = user_state::SEL_ROOM;
|
||||
} else {
|
||||
state = state::LOBBY;
|
||||
state = user_state::LOBBY;
|
||||
}
|
||||
}
|
||||
update_relation();
|
||||
@ -141,13 +141,13 @@ void user_info::update_state(int selected_game_id,
|
||||
void user_info::update_relation()
|
||||
{
|
||||
if(name == preferences::login()) {
|
||||
relation = relation::ME;
|
||||
relation = user_relation::ME;
|
||||
} else if(preferences::is_ignored(name)) {
|
||||
relation = relation::IGNORED;
|
||||
relation = user_relation::IGNORED;
|
||||
} else if(preferences::is_friend(name)) {
|
||||
relation = relation::FRIEND;
|
||||
relation = user_relation::FRIEND;
|
||||
} else {
|
||||
relation = relation::NEUTRAL;
|
||||
relation = user_relation::NEUTRAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,14 +109,14 @@ struct user_info
|
||||
|
||||
void update_relation();
|
||||
|
||||
enum class relation {
|
||||
enum class user_relation {
|
||||
ME,
|
||||
FRIEND,
|
||||
NEUTRAL,
|
||||
IGNORED
|
||||
};
|
||||
|
||||
enum class state {
|
||||
enum class user_state {
|
||||
LOBBY,
|
||||
SEL_ROOM,
|
||||
GAME,
|
||||
@ -127,8 +127,8 @@ struct user_info
|
||||
|
||||
std::string name;
|
||||
int game_id;
|
||||
relation relation;
|
||||
state state;
|
||||
user_relation relation;
|
||||
user_state state;
|
||||
bool registered;
|
||||
bool observing;
|
||||
bool moderator;
|
||||
|
@ -237,10 +237,10 @@ void lobby_info::process_userlist()
|
||||
}
|
||||
|
||||
switch(ui.relation) {
|
||||
case user_info::relation::FRIEND:
|
||||
case user_info::user_relation::FRIEND:
|
||||
g->has_friends = true;
|
||||
break;
|
||||
case user_info::relation::IGNORED:
|
||||
case user_info::user_relation::IGNORED:
|
||||
g->has_ignored = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -601,7 +601,7 @@ void mp_lobby::update_playerlist()
|
||||
icon_ss << "lobby/status";
|
||||
switch(user.state) {
|
||||
#ifdef ENABLE_ROOM_MEMBER_TREE
|
||||
case mp::user_info::state::SEL_ROOM:
|
||||
case mp::user_info::user_state::SEL_ROOM:
|
||||
icon_ss << "-lobby";
|
||||
target_list = &player_list_.active_room;
|
||||
if(lobby) {
|
||||
@ -609,16 +609,16 @@ void mp_lobby::update_playerlist()
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case mp::user_info::state::LOBBY:
|
||||
case mp::user_info::user_state::LOBBY:
|
||||
icon_ss << "-lobby";
|
||||
target_list = &player_list_.other_rooms;
|
||||
break;
|
||||
case mp::user_info::state::SEL_GAME:
|
||||
case mp::user_info::user_state::SEL_GAME:
|
||||
name = colorize(name, {0, 255, 255});
|
||||
icon_ss << (user.observing ? "-obs" : "-playing");
|
||||
target_list = &player_list_.active_game;
|
||||
break;
|
||||
case mp::user_info::state::GAME:
|
||||
case mp::user_info::user_state::GAME:
|
||||
name = colorize(name, font::BAD_COLOR);
|
||||
icon_ss << (user.observing ? "-obs" : "-playing");
|
||||
target_list = &player_list_.other_games;
|
||||
@ -629,16 +629,16 @@ void mp_lobby::update_playerlist()
|
||||
}
|
||||
|
||||
switch(user.relation) {
|
||||
case mp::user_info::relation::ME:
|
||||
case mp::user_info::user_relation::ME:
|
||||
icon_ss << "-s";
|
||||
break;
|
||||
case mp::user_info::relation::NEUTRAL:
|
||||
case mp::user_info::user_relation::NEUTRAL:
|
||||
icon_ss << "-n";
|
||||
break;
|
||||
case mp::user_info::relation::FRIEND:
|
||||
case mp::user_info::user_relation::FRIEND:
|
||||
icon_ss << "-f";
|
||||
break;
|
||||
case mp::user_info::relation::IGNORED:
|
||||
case mp::user_info::user_relation::IGNORED:
|
||||
icon_ss << "-i";
|
||||
break;
|
||||
default:
|
||||
|
@ -59,7 +59,7 @@ void lobby_player_info::pre_show(window& window)
|
||||
relation_ = find_widget<label>(&window, "relation_info", false, true);
|
||||
|
||||
button& whisper = find_widget<button>(&window, "start_whisper", false);
|
||||
if(info_.relation != mp::user_info::relation::ME) {
|
||||
if(info_.relation != mp::user_info::user_relation::ME) {
|
||||
connect_signal_mouse_left_click(whisper,
|
||||
std::bind(&lobby_player_info::start_whisper_button_callback, this));
|
||||
} else {
|
||||
@ -138,22 +138,22 @@ void lobby_player_info::update_relation()
|
||||
add_to_ignores_->set_active(false);
|
||||
remove_from_list_->set_active(false);
|
||||
switch(info_.relation) {
|
||||
case mp::user_info::relation::FRIEND:
|
||||
case mp::user_info::user_relation::FRIEND:
|
||||
relation_->set_label(_("On friends list"));
|
||||
add_to_ignores_->set_active(true);
|
||||
remove_from_list_->set_active(true);
|
||||
break;
|
||||
case mp::user_info::relation::IGNORED:
|
||||
case mp::user_info::user_relation::IGNORED:
|
||||
relation_->set_label(_("On ignores list"));
|
||||
add_to_friends_->set_active(true);
|
||||
remove_from_list_->set_active(true);
|
||||
break;
|
||||
case mp::user_info::relation::NEUTRAL:
|
||||
case mp::user_info::user_relation::NEUTRAL:
|
||||
relation_->set_label(_("Neither a friend nor ignored"));
|
||||
add_to_friends_->set_active(true);
|
||||
add_to_ignores_->set_active(true);
|
||||
break;
|
||||
case mp::user_info::relation::ME:
|
||||
case mp::user_info::user_relation::ME:
|
||||
relation_->set_label(_("You"));
|
||||
break;
|
||||
default:
|
||||
@ -164,21 +164,21 @@ void lobby_player_info::update_relation()
|
||||
void lobby_player_info::add_to_friends_button_callback()
|
||||
{
|
||||
preferences::add_acquaintance(info_.name, "friend", "");
|
||||
info_.relation = mp::user_info::relation::FRIEND;
|
||||
info_.relation = mp::user_info::user_relation::FRIEND;
|
||||
update_relation();
|
||||
}
|
||||
|
||||
void lobby_player_info::add_to_ignores_button_callback()
|
||||
{
|
||||
preferences::add_acquaintance(info_.name, "ignore", "");
|
||||
info_.relation = mp::user_info::relation::IGNORED;
|
||||
info_.relation = mp::user_info::user_relation::IGNORED;
|
||||
update_relation();
|
||||
}
|
||||
|
||||
void lobby_player_info::remove_from_list_button_callback()
|
||||
{
|
||||
preferences::remove_acquaintance(info_.name);
|
||||
info_.relation = mp::user_info::relation::NEUTRAL;
|
||||
info_.relation = mp::user_info::user_relation::NEUTRAL;
|
||||
update_relation();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user