Do not invite players who are already in the group.

This commit is contained in:
lotodore
2010-03-30 18:03:08 +00:00
parent 61fd70d407
commit 72fa1fb9ec
3 changed files with 11 additions and 1 deletions
+8
View File
@@ -464,6 +464,12 @@ ServerGame::IsPlayerConnected(const std::string &name) const
return GetSessionManager().IsPlayerConnected(name);
}
bool
ServerGame::IsPlayerConnected(unsigned playerId) const
{
return GetSessionManager().IsPlayerConnected(playerId);
}
bool
ServerGame::IsRunning() const
{
@@ -487,6 +493,8 @@ ServerGame::AddPlayerInvitation(unsigned playerId)
{
boost::mutex::scoped_lock lock(m_playerInvitationListMutex);
m_playerInvitationList.push_back(playerId);
m_playerInvitationList.sort();
m_playerInvitationList.unique();
}
void
+2 -1
View File
@@ -467,7 +467,8 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
{
InvitePlayerToGameMessage_t *netInvite = &packet->GetMsg()->choice.invitePlayerToGameMessage;
if (netInvite->gameId == server->GetId())
// Only invite players which are not already within the group.
if (netInvite->gameId == server->GetId() && !server->IsPlayerConnected(netInvite->playerId))
{
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
packet->GetMsg()->present = PokerTHMessage_PR_inviteNotifyMessage;
+1
View File
@@ -72,6 +72,7 @@ public:
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned playerId) const;
PlayerIdList GetPlayerIdList() const;
bool IsPlayerConnected(const std::string &name) const;
bool IsPlayerConnected(unsigned playerId) const;
bool IsRunning() const;