Fixed the action when players are kicked who left before being kicked.

This commit is contained in:
lotodore
2011-11-13 15:36:01 +00:00
parent edde9137ae
commit 2678bd9101
+7 -4
View File
@@ -375,17 +375,20 @@ ServerGame::InternalEndGame()
void void
ServerGame::InternalKickPlayer(unsigned playerId) ServerGame::InternalKickPlayer(unsigned playerId)
{ {
boost::shared_ptr<SessionData> tmpSession(GetSessionManager().GetSessionByUniquePlayerId(playerId)); // Mark the player as kicked in the engine.
// Only kick if the player was found.
if (tmpSession) {
if (m_game) { if (m_game) {
boost::shared_ptr<PlayerInterface> tmpPlayer(m_game->getPlayerByUniqueId(playerId)); boost::shared_ptr<PlayerInterface> tmpPlayer(m_game->getPlayerByUniqueId(playerId));
if (tmpPlayer) { if (tmpPlayer) {
// Mark the player as kicked, so that he is not allowed to rejoin. // Player was kicked, so he is not allowed to rejoin.
tmpPlayer->setIsKicked(true); tmpPlayer->setIsKicked(true);
tmpPlayer->setMyGuid(""); tmpPlayer->setMyGuid("");
} }
} }
// Kick the network session from this game.
boost::shared_ptr<SessionData> tmpSession(GetSessionManager().GetSessionByUniquePlayerId(playerId));
// Only kick if the player was found.
if (tmpSession) {
MoveSessionToLobby(tmpSession, NTF_NET_REMOVED_KICKED); MoveSessionToLobby(tmpSession, NTF_NET_REMOVED_KICKED);
} }
// KICKING COMPUTER PLAYERS IS BUGGY AND OCCASIONALLY CAUSES A CRASH // KICKING COMPUTER PLAYERS IS BUGGY AND OCCASIONALLY CAUSES A CRASH