Do not invite players who are already in the group.
This commit is contained in:
@@ -464,6 +464,12 @@ ServerGame::IsPlayerConnected(const std::string &name) const
|
|||||||
return GetSessionManager().IsPlayerConnected(name);
|
return GetSessionManager().IsPlayerConnected(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ServerGame::IsPlayerConnected(unsigned playerId) const
|
||||||
|
{
|
||||||
|
return GetSessionManager().IsPlayerConnected(playerId);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ServerGame::IsRunning() const
|
ServerGame::IsRunning() const
|
||||||
{
|
{
|
||||||
@@ -487,6 +493,8 @@ ServerGame::AddPlayerInvitation(unsigned playerId)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_playerInvitationListMutex);
|
boost::mutex::scoped_lock lock(m_playerInvitationListMutex);
|
||||||
m_playerInvitationList.push_back(playerId);
|
m_playerInvitationList.push_back(playerId);
|
||||||
|
m_playerInvitationList.sort();
|
||||||
|
m_playerInvitationList.unique();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -467,7 +467,8 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
|
|||||||
{
|
{
|
||||||
InvitePlayerToGameMessage_t *netInvite = &packet->GetMsg()->choice.invitePlayerToGameMessage;
|
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));
|
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
|
||||||
packet->GetMsg()->present = PokerTHMessage_PR_inviteNotifyMessage;
|
packet->GetMsg()->present = PokerTHMessage_PR_inviteNotifyMessage;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public:
|
|||||||
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned playerId) const;
|
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned playerId) const;
|
||||||
PlayerIdList GetPlayerIdList() const;
|
PlayerIdList GetPlayerIdList() const;
|
||||||
bool IsPlayerConnected(const std::string &name) const;
|
bool IsPlayerConnected(const std::string &name) const;
|
||||||
|
bool IsPlayerConnected(unsigned playerId) const;
|
||||||
|
|
||||||
bool IsRunning() const;
|
bool IsRunning() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user