From 2678bd91016fd8003ddd991e87cdd14bd421e154 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sun, 13 Nov 2011 15:36:01 +0000 Subject: [PATCH] Fixed the action when players are kicked who left before being kicked. --- src/net/common/servergame.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/net/common/servergame.cpp b/src/net/common/servergame.cpp index 94811072..1aed10f0 100644 --- a/src/net/common/servergame.cpp +++ b/src/net/common/servergame.cpp @@ -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 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 tmpSession(GetSessionManager().GetSessionByUniquePlayerId(playerId)); // Only kick if the player was found. if (tmpSession) { - if (m_game) { - boost::shared_ptr 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