Fixing session counter with regard to spectators.

This commit is contained in:
lotodore
2013-06-29 23:44:00 +02:00
parent ec50aa3268
commit 0be7632875
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -779,7 +779,7 @@ ServerGameStateStartGame::InternalProcessPacket(boost::shared_ptr<ServerGame> se
{
if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_StartEventAckMessage) {
session->SetReadyFlag();
if (server->GetSessionManager().CountReadySessions() == server->GetSessionManager().GetRawSessionCount()) {
if (server->GetSessionManager().CountReadySessions() == server->GetSessionManager().GetSessionCountWithState(SessionData::Game)) {
// Everyone is ready.
server->GetSessionManager().ResetAllReadyFlags();
DoStart(server);
+1 -1
View File
@@ -2125,7 +2125,7 @@ ServerLobbyThread::UpdateStatisticsNumberOfPlayers()
{
ServerStats stats;
// Get all logged-in sessions and all sessions within a game.
unsigned curNumberOfPlayersOnServer = m_sessionManager.GetEstablishedSessionCount() + m_gameSessionManager.GetRawSessionCount();
unsigned curNumberOfPlayersOnServer = m_sessionManager.GetSessionCountWithState(SessionData::Established) + m_gameSessionManager.GetRawSessionCount();
{
boost::mutex::scoped_lock lock(m_statMutex);
if (curNumberOfPlayersOnServer != m_statData.numberOfPlayersOnServer) {
+2 -2
View File
@@ -302,7 +302,7 @@ SessionManager::GetRawSessionCount()
}
unsigned
SessionManager::GetEstablishedSessionCount()
SessionManager::GetSessionCountWithState(int state)
{
unsigned counter = 0;
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
@@ -311,7 +311,7 @@ SessionManager::GetEstablishedSessionCount()
SessionMap::const_iterator end = m_sessionMap.end();
while (i != end) {
if ((*i).second->GetState() >= SessionData::Established)
if ((i->second->GetState() & state) != 0)
++counter;
++i;
}
+1 -1
View File
@@ -73,7 +73,7 @@ public:
void Clear();
unsigned GetRawSessionCount();
unsigned GetEstablishedSessionCount();
unsigned GetSessionCountWithState(int state);
void SendToAllSessions(SenderHelper &sender, boost::shared_ptr<NetPacket> packet, int state);
void SendLobbyMsgToAllSessions(SenderHelper &sender, boost::shared_ptr<NetPacket> packet, int state);