astyle, optimizations and test removed
This commit is contained in:
@@ -1171,8 +1171,8 @@ ServerGame::AddPlayerToNumJoinsPerPlayer(const std::string &playerName)
|
||||
NumJoinsPerPlayerMap::iterator pos = m_numJoinsPerPlayer.find(playerName);
|
||||
if (pos != m_numJoinsPerPlayer.end())
|
||||
{
|
||||
pos->second++;
|
||||
} else{
|
||||
pos->second++;
|
||||
} else {
|
||||
m_numJoinsPerPlayer[playerName] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ using namespace std;
|
||||
#define SERVER_LOOP_DELAY_MSEC 50
|
||||
#define SERVER_MAX_NUM_SPECTATORS_PER_GAME 100
|
||||
|
||||
#define GAME_MAX_NUM_JOINS_PER_PLAYER 6
|
||||
#define GAME_MAX_NUM_JOINS_PER_PLAYER 6
|
||||
|
||||
// Helper functions
|
||||
|
||||
|
||||
@@ -260,9 +260,9 @@ SessionManager::IsGuestAllowedToConnect(const std::string &clientAddress) const
|
||||
int num = 0;
|
||||
while (i != end) {
|
||||
boost::shared_ptr<PlayerData> tmpPlayer(i->second->GetPlayerData());
|
||||
if(tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_GUEST){
|
||||
if(tmpPlayer && tmpPlayer->GetRights() == PLAYER_RIGHTS_GUEST) {
|
||||
num++;
|
||||
if(i->second->GetClientAddr() == clientAddress || num >= SERVER_MAX_GUEST_USERS_LOBBY) {
|
||||
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;
|
||||
@@ -271,6 +271,10 @@ SessionManager::IsGuestAllowedToConnect(const std::string &clientAddress) const
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
// Check if number of players in lobby exceeds max
|
||||
if (num >= SERVER_MAX_GUEST_USERS_LOBBY) retVal = false;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
#include <boost/atomic.hpp>
|
||||
|
||||
#include <net/sessionmanager.h>
|
||||
#include <net/netpacket.h>
|
||||
|
||||
Reference in New Issue
Block a user