Disable rejoin for players who have been kicked.

This commit is contained in:
lotodore
2011-11-13 14:28:54 +00:00
parent 982b6ec686
commit edef79e9d1
7 changed files with 62 additions and 16 deletions
+15 -3
View File
@@ -375,10 +375,19 @@ ServerGame::InternalEndGame()
void
ServerGame::InternalKickPlayer(unsigned playerId)
{
boost::shared_ptr<SessionData> tmpSession = GetSessionManager().GetSessionByUniquePlayerId(playerId);
boost::shared_ptr<SessionData> tmpSession(GetSessionManager().GetSessionByUniquePlayerId(playerId));
// Only kick if the player was found.
if (tmpSession)
if (tmpSession) {
if (m_game) {
boost::shared_ptr<PlayerInterface> tmpPlayer(m_game->getPlayerByUniqueId(playerId));
if (tmpPlayer) {
// Mark the player as kicked, so that he is not allowed to rejoin.
tmpPlayer->setIsKicked(true);
tmpPlayer->setMyGuid("");
}
}
MoveSessionToLobby(tmpSession, NTF_NET_REMOVED_KICKED);
}
// KICKING COMPUTER PLAYERS IS BUGGY AND OCCASIONALLY CAUSES A CRASH
// Disabled for now.
//else
@@ -811,7 +820,10 @@ ServerGame::RemoveDisconnectedPlayers()
if ((tmpPlayer->getMyType() == PLAYER_TYPE_HUMAN && !GetSessionManager().IsPlayerConnected(tmpPlayer->getMyUniqueID()))
|| (tmpPlayer->getMyType() == PLAYER_TYPE_COMPUTER && !IsComputerPlayerActive(tmpPlayer->getMyUniqueID()))) {
// Setting player cash to 0 will deactivate the player.
//tmpPlayer->setMyCash(0);
// The player should only be deactivated if rejoin is not possible.
if (tmpPlayer->isKicked() || tmpPlayer->getMyGuid().empty()) {
tmpPlayer->setMyCash(0);
}
tmpPlayer->setIsConnected(false);
}
++i;
+13 -11
View File
@@ -905,7 +905,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
else if (packet->GetMsg()->present == PokerTHMessage_PR_avatarRequestMessage)
HandleNetPacketRetrieveAvatar(session, packet->GetMsg()->choice.avatarRequestMessage);
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
{}
{}
else if (packet->GetMsg()->present == PokerTHMessage_PR_subscriptionRequestMessage) {
SubscriptionRequestMessage_t *subscriptionRequest = &packet->GetMsg()->choice.subscriptionRequestMessage;
if (subscriptionRequest->subscriptionAction == subscriptionAction_resubscribeGameList)
@@ -2207,17 +2207,19 @@ u_int32_t
ServerLobbyThread::GetRejoinGameIdForPlayer(const std::string &playerName, const std::string &guid, unsigned &outPlayerUniqueId)
{
u_int32_t retGameId = 0;
GameMap::iterator i = m_gameMap.begin();
GameMap::iterator end = m_gameMap.end();
while (i != end) {
boost::shared_ptr<ServerGame> tmpGame = i->second;
boost::shared_ptr<PlayerInterface> tmpPlayer = tmpGame->GetPlayerInterfaceFromGame(playerName);
if (tmpPlayer && tmpPlayer->getMyGuid() == guid) {
retGameId = tmpGame->GetId();
outPlayerUniqueId = tmpPlayer->getMyUniqueID();
break;
if (!guid.empty()) {
GameMap::iterator i = m_gameMap.begin();
GameMap::iterator end = m_gameMap.end();
while (i != end) {
boost::shared_ptr<ServerGame> tmpGame = i->second;
boost::shared_ptr<PlayerInterface> tmpPlayer = tmpGame->GetPlayerInterfaceFromGame(playerName);
if (tmpPlayer && tmpPlayer->getMyGuid() == guid) {
retGameId = tmpGame->GetId();
outPlayerUniqueId = tmpPlayer->getMyUniqueID();
break;
}
++i;
}
++i;
}
return retGameId;
}