Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
NetPlayServer: Drop all the pads for a client when she disconnects
This makes intuitive sense, and prevents issues with users stealing
up all the pads and requiring admin intervention to participate.
  • Loading branch information
magcius committed Sep 14, 2013
1 parent 0040e66 commit f830b85
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/Core/Core/Src/NetPlayServer.cpp
Expand Up @@ -238,9 +238,11 @@ unsigned int NetPlayServer::OnDisconnect(sf::SocketTCP& socket)
SendToClients(spac);
}

int pid = m_players[socket].pid;

sf::Packet spac;
spac << (MessageId)NP_MSG_PLAYER_LEAVE;
spac << m_players[socket].pid;
spac << pid;

m_selector.Remove(socket);

Expand All @@ -251,6 +253,11 @@ unsigned int NetPlayServer::OnDisconnect(sf::SocketTCP& socket)
std::lock_guard<std::recursive_mutex> lks(m_crit.send);
SendToClients(spac);

for (int i = 0; i < 4; i++)
if (m_pad_map[i] == pid)
m_pad_map[i] = -1;
UpdatePadMapping();

return 0;
}

Expand Down

0 comments on commit f830b85

Please sign in to comment.