Preparing "reportGameName" network message.

This commit is contained in:
lotodore
2012-03-31 20:14:11 +00:00
parent 7ff145a66a
commit ac0041cb8f
112 changed files with 773 additions and 365 deletions
+3 -3
View File
@@ -753,11 +753,11 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
} else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_reportAvatarAckMessage) {
ReportAvatarAckMessage_t *netReportAck = &tmpPacket->GetMsg()->choice.reportAvatarAckMessage;
unsigned msgCode;
switch (netReportAck->reportResult) {
case reportResult_avatarReportAccepted:
switch (netReportAck->reportAvatarResult) {
case reportAvatarResult_avatarReportAccepted:
msgCode = MSG_NET_AVATAR_REPORT_ACCEPTED;
break;
case reportResult_avatarReportDuplicate:
case reportAvatarResult_avatarReportDuplicate:
msgCode = MSG_NET_AVATAR_REPORT_DUP;
break;
default:
+10
View File
@@ -385,6 +385,16 @@ ClientThread::SendReportAvatar(unsigned reportedPlayerId, const std::string &ava
}
}
void
ClientThread::SendReportGameName(unsigned reportedGameId)
{
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
packet->GetMsg()->present = PokerTHMessage_PR_reportGameMessage;
ReportGameMessage_t *netReport = &packet->GetMsg()->choice.reportGameMessage;
netReport->reportedGameId = reportedGameId;
m_ioService->post(boost::bind(&ClientThread::SendSessionPacket, shared_from_this(), packet));
}
void
ClientThread::StartAsyncRead()
{
+1 -1
View File
@@ -84,7 +84,7 @@ void
SenderHelper::InternalStorePacket(SendBuffer &tmpBuffer, boost::shared_ptr<NetPacket> packet)
{
asn_enc_rval_t e = der_encode(&asn_DEF_PokerTHMessage, packet->GetMsg(), &SendBuffer::EncodeToBuf, &tmpBuffer);
//cerr << "OUT:" << endl << packet->ToString() << endl;
cerr << "OUT:" << endl << packet->ToString() << endl;
if (e.encoded == -1)
LOG_ERROR("Failed to encode NetPacket: " << packet->GetMsg()->present);
}
+2 -2
View File
@@ -347,7 +347,7 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
packet->GetMsg()->present = PokerTHMessage_PR_reportAvatarAckMessage;
ReportAvatarAckMessage_t *netReportAck = &packet->GetMsg()->choice.reportAvatarAckMessage;
netReportAck->reportedPlayerId = netReport->reportedPlayerId;
netReportAck->reportResult = reportResult_avatarReportDuplicate;
netReportAck->reportAvatarResult = reportAvatarResult_avatarReportDuplicate;
server->GetLobbyThread().GetSender().Send(session, packet);
}
} else {
@@ -355,7 +355,7 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
packet->GetMsg()->present = PokerTHMessage_PR_reportAvatarAckMessage;
ReportAvatarAckMessage_t *netReportAck = &packet->GetMsg()->choice.reportAvatarAckMessage;
netReportAck->reportedPlayerId = netReport->reportedPlayerId;
netReportAck->reportResult = reportResult_avatarReportInvalid;
netReportAck->reportAvatarResult = reportAvatarResult_avatarReportInvalid;
server->GetLobbyThread().GetSender().Send(session, packet);
}
} else {
+1 -1
View File
@@ -1620,7 +1620,7 @@ ServerLobbyThread::SendReportAvatarResult(unsigned byPlayerId, unsigned reported
packet->GetMsg()->present = PokerTHMessage_PR_reportAvatarAckMessage;
ReportAvatarAckMessage_t *netReportAck = &packet->GetMsg()->choice.reportAvatarAckMessage;
netReportAck->reportedPlayerId = reportedPlayerId;
netReportAck->reportResult = success ? reportResult_avatarReportAccepted : reportResult_avatarReportInvalid;
netReportAck->reportAvatarResult = success ? reportAvatarResult_avatarReportAccepted : reportAvatarResult_avatarReportInvalid;
GetSender().Send(session, packet);
}
}