This commit is contained in:
aozhiwei 2020-12-13 11:30:09 +08:00
parent 685eb839bf
commit 93bb37d423

View File

@ -58,12 +58,9 @@ void ChatMgr::FillSMUpdatePrivateChatRedPointNotify(Player* hum,
void ChatMgr::ProcWorldChat(Player* hum, const cs::CMSendChatMsg& msg)
{
++world_msg_id_;
cs::MFChatMsg* p = new cs::MFChatMsg();
p->set_msg_uuid(world_msg_id_);
p->set_msg_uuid(++world_msg_id_);
hum->FillMFUserInfo(p->mutable_sender());
//p->set_receiver(world_msg_id_);
p->set_chat_channel(msg.chat_channel());
p->set_msg_type(msg.msg_type());
p->set_msg_body(msg.msg_body());
@ -180,7 +177,6 @@ void ChatMgr::ProcBigHornChat(Player* hum, const cs::CMSendChatMsg& msg)
cs::MFChatMsg* p = new cs::MFChatMsg();
p->set_msg_uuid(temp_msg_id_);
hum->FillMFUserInfo(p->mutable_sender());
//p->set_receiver(world_msg_id_);
p->set_chat_channel(msg.chat_channel());
p->set_msg_type(msg.msg_type());
p->set_msg_body(msg.msg_body());
@ -193,7 +189,19 @@ void ChatMgr::ProcBigHornChat(Player* hum, const cs::CMSendChatMsg& msg)
{
hum->SendMsg(notifymsg);
});
delete p;
{
p->set_msg_uuid(++world_msg_id_);
p->set_chat_channel(kCCWorld);
world_msgrec_.curr_id = world_msg_id_;
world_msgrec_.msg_list.push_back(p);
world_msgrec_.PopAndDelete(50);
PlayerMgr::Instance()->TraversePlayer
([](Player* hum)
{
ChatMgr::Instance()->SyncWorldChatMsg(hum);
});
}
}
void ChatMgr::ProcLoopMsgChat(Player* hum, const cs::CMSendChatMsg& msg)
@ -304,13 +312,12 @@ void ChatMgr::OnPlayerOnline(Player* hum)
} else if (msg->msg_uuid() > init_last_id){
msg->set_msg_uuid(hum->IncDBPrivateChatLastId());
}
if (msg->msg_uuid() > user->last_id) {
msg->last_id = msg->msg_uuid();
if (msg->msg_uuid() > pair.second.last_id) {
pair.second.last_id = msg->msg_uuid();
}
if (pair.second.curr_id > pair.second.last_id) {
pair.second.curr_id = pair.second.last_id;
}
}
//end for msg_list
if (user->curr_id > user->last_id) {
user->curr_id = user->last_id;
}
}
}