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
+11 -8
View File
@@ -375,17 +375,20 @@ ServerGame::InternalEndGame()
void
ServerGame::InternalKickPlayer(unsigned playerId)
{
// Mark the player as kicked in the engine.
if (m_game) {
boost::shared_ptr<PlayerInterface> tmpPlayer(m_game->getPlayerByUniqueId(playerId));
if (tmpPlayer) {
// Player was kicked, so he is not allowed to rejoin.
tmpPlayer->setIsKicked(true);
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) {
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