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.
This commit is contained in:
Jasper St. Pierre 2013-09-13 21:33:11 -04:00
parent 0040e66282
commit f830b85d10

View File

@ -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);
@ -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;
}