diff --git a/src/net/common/servergame.cpp b/src/net/common/servergame.cpp index 34cde66d..26857151 100644 --- a/src/net/common/servergame.cpp +++ b/src/net/common/servergame.cpp @@ -1181,8 +1181,9 @@ int ServerGame::GetNumJoinsPerPlayer(const std::string &playerName) { int num = 0; - if(m_numJoinsPerPlayer.find(playerName) != m_numJoinsPerPlayer.end()) { - num = m_numJoinsPerPlayer[playerName]; + NumJoinsPerPlayerMap::const_iterator pos = m_numJoinsPerPlayer.find(playerName); + if (pos != m_numJoinsPerPlayer.end()) { + num = pos->second; } return num; } diff --git a/src/net/common/sessionmanager.cpp b/src/net/common/sessionmanager.cpp index 67599b62..f4e00461 100644 --- a/src/net/common/sessionmanager.cpp +++ b/src/net/common/sessionmanager.cpp @@ -260,11 +260,10 @@ SessionManager::IsGuestAllowedToConnect(const std::string &clientAddress) const int num = 0; while (i != end) { boost::shared_ptr tmpPlayer(i->second->GetPlayerData()); - if(tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_GUEST) { + if (tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_GUEST) { num++; - if(i->second->GetClientAddr() == clientAddress) { + if (i->second->GetClientAddr() == clientAddress) { // guest has same ip as another guest in lobby or - // number of guests in lobby >= SERVER_MAX_GUEST_USERS_LOBBY => not allowed retVal = false; break; }