Next steps for invitation system.
This commit is contained in:
@@ -1326,7 +1326,7 @@ void gameLobbyDialogImpl::invitePlayerToCurrentGame()
|
|||||||
{
|
{
|
||||||
if(!treeWidget_NickList->selectedItems().isEmpty()) {
|
if(!treeWidget_NickList->selectedItems().isEmpty()) {
|
||||||
mySession->invitePlayerToCurrentGame(treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt());
|
mySession->invitePlayerToCurrentGame(treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt());
|
||||||
}\
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameLobbyDialogImpl::showInfoMsgBox()
|
void gameLobbyDialogImpl::showInfoMsgBox()
|
||||||
|
|||||||
@@ -1486,6 +1486,22 @@ ClientStateWaitGame::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
|||||||
client->AddPlayerData(playerData);
|
client->AddPlayerData(playerData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_inviteNotifyMessage)
|
||||||
|
{
|
||||||
|
InviteNotifyMessage_t *netInvNotify = &tmpPacket->GetMsg()->choice.inviteNotifyMessage;
|
||||||
|
client->GetCallback()->SignalPlayerGameInvitation(
|
||||||
|
netInvNotify->gameId,
|
||||||
|
netInvNotify->playerIdWho,
|
||||||
|
netInvNotify->playerIdByWhom);
|
||||||
|
}
|
||||||
|
else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_rejectInvNotifyMessage)
|
||||||
|
{
|
||||||
|
RejectInvNotifyMessage_t *netRejNotify = &tmpPacket->GetMsg()->choice.rejectInvNotifyMessage;
|
||||||
|
client->GetCallback()->SignalPlayerGameInvitation(
|
||||||
|
netRejNotify->gameId,
|
||||||
|
netRejNotify->playerId,
|
||||||
|
static_cast<DenyGameInvitationReason>(netRejNotify->playerRejectReason));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -475,8 +475,20 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
|
|||||||
netInvNotif->playerIdByWhom = session.playerData->GetUniqueId();
|
netInvNotif->playerIdByWhom = session.playerData->GetUniqueId();
|
||||||
netInvNotif->playerIdWho = netInvite->playerId;
|
netInvNotif->playerIdWho = netInvite->playerId;
|
||||||
|
|
||||||
server->GetLobbyThread().SendToLobbyPlayer(netInvite->playerId, packet);
|
bool requestSent = server->GetLobbyThread().SendToLobbyPlayer(netInvite->playerId, packet);
|
||||||
server->SendToAllPlayers(packet, SessionData::Game);
|
server->SendToAllPlayers(packet, SessionData::Game);
|
||||||
|
if (!requestSent)
|
||||||
|
{
|
||||||
|
// Player is not in lobby - send reject message.
|
||||||
|
boost::shared_ptr<NetPacket> p2(new NetPacket(NetPacket::Alloc));
|
||||||
|
p2->GetMsg()->present = PokerTHMessage_PR_rejectInvNotifyMessage;
|
||||||
|
RejectInvNotifyMessage_t *netRejNotif = &p2->GetMsg()->choice.rejectInvNotifyMessage;
|
||||||
|
netRejNotif->gameId = netInvite->gameId;
|
||||||
|
netRejNotif->playerId = netInvite->playerId;
|
||||||
|
netRejNotif->playerRejectReason = RejectGameInvReason_busy;
|
||||||
|
|
||||||
|
server->SendToAllPlayers(p2, SessionData::Game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
||||||
|
|||||||
@@ -564,12 +564,17 @@ ServerLobbyThread::RemoveComputerPlayer(boost::shared_ptr<PlayerData> player)
|
|||||||
m_computerPlayers.erase(player->GetUniqueId());
|
m_computerPlayers.erase(player->GetUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
ServerLobbyThread::SendToLobbyPlayer(unsigned playerId, boost::shared_ptr<NetPacket> packet)
|
ServerLobbyThread::SendToLobbyPlayer(unsigned playerId, boost::shared_ptr<NetPacket> packet)
|
||||||
{
|
{
|
||||||
|
bool retVal = false;
|
||||||
SessionWrapper tmpSession = m_sessionManager.GetSessionByUniquePlayerId(playerId);
|
SessionWrapper tmpSession = m_sessionManager.GetSessionByUniquePlayerId(playerId);
|
||||||
if (tmpSession.sessionData)
|
if (tmpSession.sessionData)
|
||||||
|
{
|
||||||
GetSender().Send(tmpSession.sessionData, packet);
|
GetSender().Send(tmpSession.sessionData, packet);
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarManager &
|
AvatarManager &
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
void AddComputerPlayer(boost::shared_ptr<PlayerData> player);
|
void AddComputerPlayer(boost::shared_ptr<PlayerData> player);
|
||||||
void RemoveComputerPlayer(boost::shared_ptr<PlayerData> player);
|
void RemoveComputerPlayer(boost::shared_ptr<PlayerData> player);
|
||||||
|
|
||||||
void SendToLobbyPlayer(unsigned playerId, boost::shared_ptr<NetPacket> packet);
|
bool SendToLobbyPlayer(unsigned playerId, boost::shared_ptr<NetPacket> packet);
|
||||||
|
|
||||||
u_int32_t GetNextUniquePlayerId();
|
u_int32_t GetNextUniquePlayerId();
|
||||||
u_int32_t GetNextGameId();
|
u_int32_t GetNextGameId();
|
||||||
|
|||||||
Reference in New Issue
Block a user