This commit is contained in:
aozhiwei 2020-05-12 17:42:56 +08:00
parent ddd0dffd5b
commit 7f9bc2b4f5

View File

@ -1,6 +1,7 @@
#include "precompile.h"
#include <a8/openssl.h>
#include <a8/timer.h>
#include "player.h"
#include "playermgr.h"
@ -205,6 +206,29 @@ void Player::ForwardGroupCMMsg(f8::MsgHdr& hdr, long long hash_code)
MSConnMgr::Instance()->SendMsg(msg, hash_code);
}
void Player::MarkDirty()
{
if (!dirty_) {
dirty_ = true;
dirty_timer_ = a8::Timer::Instance()->
AddDeadLineTimerAndAttach(1000 * 60,
a8::XParams()
.SetSender((void*)this),
[] (const a8::XParams& param)
{
Player* hum = (Player*)param.sender.GetUserData();
hum->SaveToDB();
},
&timer_attacher.timer_list_,
[] (const a8::XParams& param)
{
Player* hum = (Player*)param.sender.GetUserData();
hum->dirty_timer_ = nullptr;
}
);
}
}
void Player::FillFriendDB(cs::MFFriendDB& friend_db)
{