Implementing player list for new lobby chat.

This commit is contained in:
lotodore
2009-08-15 22:20:19 +00:00
parent 51d8883e88
commit a380497bc2
6 changed files with 48 additions and 8 deletions
+19 -3
View File
@@ -263,6 +263,8 @@ ServerLobbyThread::CloseSession(SessionWrapper session)
m_sessionManager.RemoveSession(session.sessionData->GetId());
m_gameSessionManager.RemoveSession(session.sessionData->GetId());
if (session.playerData)
NotifyPlayerLeftLobby(session.playerData->GetUniqueId());
// Update stats (if needed).
UpdateStatisticsNumberOfPlayers();
}
@@ -274,6 +276,22 @@ ServerLobbyThread::ResubscribeLobbyMsg(SessionWrapper session)
InternalResubscribeMsg(session);
}
void
ServerLobbyThread::NotifyPlayerJoinedLobby(unsigned playerId)
{
boost::shared_ptr<NetPacket> notify = CreateNetPacketPlayerListNew(playerId);
m_sessionManager.SendLobbyMsgToAllSessions(GetSender(), notify, SessionData::Established);
m_gameSessionManager.SendLobbyMsgToAllSessions(GetSender(), notify, SessionData::Game);
}
void
ServerLobbyThread::NotifyPlayerLeftLobby(unsigned playerId)
{
boost::shared_ptr<NetPacket> notify = CreateNetPacketPlayerListLeft(playerId);
m_sessionManager.SendLobbyMsgToAllSessions(GetSender(), notify, SessionData::Established);
m_gameSessionManager.SendLobbyMsgToAllSessions(GetSender(), notify, SessionData::Game);
}
void
ServerLobbyThread::NotifyPlayerJoinedGame(unsigned gameId, unsigned playerId)
{
@@ -1129,9 +1147,7 @@ ServerLobbyThread::EstablishSession(SessionWrapper session)
m_statDataChanged = true;
}
// Notify all players.
boost::shared_ptr<NetPacket> notify = CreateNetPacketPlayerListNew(session.playerData->GetUniqueId());
m_sessionManager.SendLobbyMsgToAllSessions(GetSender(), notify, SessionData::Established);
m_gameSessionManager.SendLobbyMsgToAllSessions(GetSender(), notify, SessionData::Game);
NotifyPlayerJoinedLobby(session.playerData->GetUniqueId());
UpdateStatisticsNumberOfPlayers();
}