Move spectators to lobby before closing a game.

This commit is contained in:
lotodore
2013-10-05 12:49:21 +02:00
parent 3710f94c1e
commit bc7f34a2a6
9 changed files with 37 additions and 2 deletions
+15
View File
@@ -198,6 +198,21 @@ ServerGame::RemoveAllSessions()
SetState(ServerGameStateFinal::Instance());
}
void
ServerGame::MoveSpectatorsToLobby()
{
PlayerIdList spectatorList = GetSpectatorIdList();
PlayerIdList::const_iterator i = spectatorList.begin();
PlayerIdList::const_iterator end = spectatorList.end();
while (i != end) {
boost::shared_ptr<SessionData> tmpSession = GetSessionManager().GetSessionByUniquePlayerId(*i);
// Only remove if the spectator was found.
if (tmpSession)
MoveSessionToLobby(tmpSession, NTF_NET_REMOVED_GAME_CLOSED);
++i;
}
}
void
ServerGame::TimerVoteKick(const boost::system::error_code &ec)
{