All players within a single ranking game need different ip addresses.
This commit is contained in:
@@ -581,6 +581,12 @@ ServerGame::IsPlayerConnected(unsigned playerId) const
|
||||
return GetSessionManager().IsPlayerConnected(playerId);
|
||||
}
|
||||
|
||||
bool
|
||||
ServerGame::IsClientAddressConnected(const std::string &clientAddress) const
|
||||
{
|
||||
return GetSessionManager().IsClientAddressConnected(clientAddress);
|
||||
}
|
||||
|
||||
bool
|
||||
ServerGame::IsRunning() const
|
||||
{
|
||||
|
||||
@@ -1395,6 +1395,11 @@ ServerLobbyThread::HandleNetPacketJoinGame(SessionWrapper session, const std::st
|
||||
{
|
||||
SendJoinGameFailed(session.sessionData, joinGame.gameId, NTF_NET_JOIN_INVALID_PASSWORD);
|
||||
}
|
||||
else if (tmpData.gameType == GAME_TYPE_RANKING
|
||||
&& game.IsClientAddressConnected(session.sessionData->GetClientAddr()))
|
||||
{
|
||||
SendJoinGameFailed(session.sessionData, joinGame.gameId, NTF_NET_JOIN_GAME_FULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveSessionToGame(game, session);
|
||||
|
||||
@@ -218,6 +218,27 @@ SessionManager::IsPlayerConnected(unsigned uniqueId) const
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool
|
||||
SessionManager::IsClientAddressConnected(const std::string &clientAddress) const
|
||||
{
|
||||
bool retVal = false;
|
||||
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
||||
|
||||
SessionMap::const_iterator i = m_sessionMap.begin();
|
||||
SessionMap::const_iterator end = m_sessionMap.end();
|
||||
|
||||
while (i != end)
|
||||
{
|
||||
if ((*i).second.sessionData->GetClientAddr() == clientAddress)
|
||||
{
|
||||
retVal = true;
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void
|
||||
SessionManager::ForEach(boost::function<void (SessionWrapper)> func)
|
||||
{
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
PlayerIdList GetPlayerIdList() const;
|
||||
bool IsPlayerConnected(const std::string &name) const;
|
||||
bool IsPlayerConnected(unsigned playerId) const;
|
||||
bool IsClientAddressConnected(const std::string &clientAddress) const;
|
||||
|
||||
bool IsRunning() const;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
PlayerIdList GetPlayerIdList(SessionData::State state) const;
|
||||
bool IsPlayerConnected(const std::string &playerName) const;
|
||||
bool IsPlayerConnected(unsigned uniqueId) const;
|
||||
bool IsClientAddressConnected(const std::string &clientAddress) const;
|
||||
|
||||
void ForEach(boost::function<void (SessionWrapper)> func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user