Fixing session counter with regard to spectators.
This commit is contained in:
@@ -779,7 +779,7 @@ ServerGameStateStartGame::InternalProcessPacket(boost::shared_ptr<ServerGame> se
|
|||||||
{
|
{
|
||||||
if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_StartEventAckMessage) {
|
if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_StartEventAckMessage) {
|
||||||
session->SetReadyFlag();
|
session->SetReadyFlag();
|
||||||
if (server->GetSessionManager().CountReadySessions() == server->GetSessionManager().GetRawSessionCount()) {
|
if (server->GetSessionManager().CountReadySessions() == server->GetSessionManager().GetSessionCountWithState(SessionData::Game)) {
|
||||||
// Everyone is ready.
|
// Everyone is ready.
|
||||||
server->GetSessionManager().ResetAllReadyFlags();
|
server->GetSessionManager().ResetAllReadyFlags();
|
||||||
DoStart(server);
|
DoStart(server);
|
||||||
|
|||||||
@@ -2125,7 +2125,7 @@ ServerLobbyThread::UpdateStatisticsNumberOfPlayers()
|
|||||||
{
|
{
|
||||||
ServerStats stats;
|
ServerStats stats;
|
||||||
// Get all logged-in sessions and all sessions within a game.
|
// 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);
|
boost::mutex::scoped_lock lock(m_statMutex);
|
||||||
if (curNumberOfPlayersOnServer != m_statData.numberOfPlayersOnServer) {
|
if (curNumberOfPlayersOnServer != m_statData.numberOfPlayersOnServer) {
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ SessionManager::GetRawSessionCount()
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
SessionManager::GetEstablishedSessionCount()
|
SessionManager::GetSessionCountWithState(int state)
|
||||||
{
|
{
|
||||||
unsigned counter = 0;
|
unsigned counter = 0;
|
||||||
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
||||||
@@ -311,7 +311,7 @@ SessionManager::GetEstablishedSessionCount()
|
|||||||
SessionMap::const_iterator end = m_sessionMap.end();
|
SessionMap::const_iterator end = m_sessionMap.end();
|
||||||
|
|
||||||
while (i != end) {
|
while (i != end) {
|
||||||
if ((*i).second->GetState() >= SessionData::Established)
|
if ((i->second->GetState() & state) != 0)
|
||||||
++counter;
|
++counter;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
unsigned GetRawSessionCount();
|
unsigned GetRawSessionCount();
|
||||||
unsigned GetEstablishedSessionCount();
|
unsigned GetSessionCountWithState(int state);
|
||||||
|
|
||||||
void SendToAllSessions(SenderHelper &sender, boost::shared_ptr<NetPacket> packet, int state);
|
void SendToAllSessions(SenderHelper &sender, boost::shared_ptr<NetPacket> packet, int state);
|
||||||
void SendLobbyMsgToAllSessions(SenderHelper &sender, boost::shared_ptr<NetPacket> packet, int state);
|
void SendLobbyMsgToAllSessions(SenderHelper &sender, boost::shared_ptr<NetPacket> packet, int state);
|
||||||
|
|||||||
Reference in New Issue
Block a user