diff --git a/src/net/common/servergame.cpp b/src/net/common/servergame.cpp index ee6bd329..16bf5019 100644 --- a/src/net/common/servergame.cpp +++ b/src/net/common/servergame.cpp @@ -281,7 +281,7 @@ ServerGame::InternalAskVoteKick(SessionWrapper byWhom, unsigned playerIdWho, uns if (IsRunning() && byWhom.playerData) { // Retrieve only the number of human players. - size_t numPlayers = GetSessionManager().GetPlayerIdList().size(); + size_t numPlayers = GetSessionManager().GetPlayerIdList(SessionData::Game).size(); if (numPlayers > 2) { // Check whether the player to be kicked exists. @@ -430,7 +430,7 @@ ServerGame::GetPlayerDataByUniqueId(unsigned playerId) const PlayerIdList ServerGame::GetPlayerIdList() const { - PlayerIdList idList(GetSessionManager().GetPlayerIdList()); + PlayerIdList idList(GetSessionManager().GetPlayerIdList(SessionData::Game)); boost::mutex::scoped_lock lock(m_computerPlayerListMutex); PlayerDataList::const_iterator i = m_computerPlayerList.begin(); PlayerDataList::const_iterator end = m_computerPlayerList.end(); diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index fc957d86..9fcf3c46 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -1487,8 +1487,8 @@ void ServerLobbyThread::SendPlayerList(boost::shared_ptr s) { // Retrieve all player ids. - PlayerIdList idList(m_sessionManager.GetPlayerIdList()); - PlayerIdList gameIdList(m_gameSessionManager.GetPlayerIdList()); + PlayerIdList idList(m_sessionManager.GetPlayerIdList(SessionData::Established)); + PlayerIdList gameIdList(m_gameSessionManager.GetPlayerIdList(SessionData::Game)); idList.splice(idList.begin(), gameIdList); // Send all player ids to client. PlayerIdList::const_iterator i = idList.begin(); diff --git a/src/net/common/sessionmanager.cpp b/src/net/common/sessionmanager.cpp index 9aac68cd..7c820d90 100644 --- a/src/net/common/sessionmanager.cpp +++ b/src/net/common/sessionmanager.cpp @@ -174,7 +174,7 @@ SessionManager::GetPlayerDataList() const } PlayerIdList -SessionManager::GetPlayerIdList() const +SessionManager::GetPlayerIdList(SessionData::State state) const { PlayerIdList playerList; boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex); @@ -185,7 +185,7 @@ SessionManager::GetPlayerIdList() const while (session_i != session_end) { // Get all players in the game. - if (session_i->second.sessionData->GetState() == SessionData::Game) + if (session_i->second.sessionData->GetState() == state) { playerList.push_back(session_i->second.playerData->GetUniqueId()); } diff --git a/src/net/sessionmanager.h b/src/net/sessionmanager.h index 03ba7ec7..0ffaab51 100644 --- a/src/net/sessionmanager.h +++ b/src/net/sessionmanager.h @@ -58,7 +58,7 @@ public: SessionWrapper GetSessionByUniquePlayerId(unsigned uniqueId) const; PlayerDataList GetPlayerDataList() const; - PlayerIdList GetPlayerIdList() const; + PlayerIdList GetPlayerIdList(SessionData::State state) const; bool IsPlayerConnected(const std::string &playerName) const; bool IsPlayerConnected(unsigned uniqueId) const;