Skip to content

Commit

Permalink
remove doubled checks for game membership
Browse files Browse the repository at this point in the history
If the player is a part of the game, their ptr is valid, so the is_member call is useless.
  • Loading branch information
kabachuha authored and soliton- committed Dec 4, 2020
1 parent af579c6 commit f84cfde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/wesnothd/server.cpp
Expand Up @@ -1124,7 +1124,7 @@ void server::handle_whisper(socket_ptr socket, simple_wml::node& whisper)
}

auto g = player_connections_.find(socket)->get_game();
if(g && g->started() && g->is_player(receiver_iter->socket()) && g->is_member(socket)) {
if(g && g->started() && g->is_player(receiver_iter->socket())) {
send_server_message(socket, "You cannot send private messages to players in a running game you observe.", "error");
return;
}
Expand Down Expand Up @@ -2170,7 +2170,7 @@ void server::roll_handler(const std::string& issuer_name,
}

auto g_ptr = player_ptr->get_game();
if(g_ptr && g_ptr->is_member(player_ptr->socket())) {
if(g_ptr) {
g_ptr->send_server_message_to_all(issuer_name + " rolled a die [1 - " + parameters + "] and got a " + value + ".", player_ptr->socket());
} else {
*out << " (The result is shown to others only in a game.)";
Expand Down

0 comments on commit f84cfde

Please sign in to comment.