All players within a single ranking game need different ip addresses.

This commit is contained in:
lotodore
2010-10-02 19:50:49 +00:00
parent 3141743430
commit 0402313115
5 changed files with 34 additions and 0 deletions
+6
View File
@@ -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
{
+5
View File
@@ -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);
+21
View File
@@ -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)
{
+1
View File
@@ -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;
+1
View File
@@ -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);