1
This commit is contained in:
parent
0aee4bad67
commit
c4fc5922e8
@ -44,10 +44,6 @@ void Player::Init()
|
|||||||
},
|
},
|
||||||
&timer_attacher.timer_list_
|
&timer_attacher.timer_list_
|
||||||
);
|
);
|
||||||
#ifdef DEBUG
|
|
||||||
red_point_flags_ = 1;
|
|
||||||
SyncRedPoint();
|
|
||||||
#endif
|
|
||||||
if (App::Instance()->IsTimeToReset(role_data.last_save_time)) {
|
if (App::Instance()->IsTimeToReset(role_data.last_save_time)) {
|
||||||
OnDailyReset();
|
OnDailyReset();
|
||||||
}
|
}
|
||||||
@ -63,6 +59,9 @@ void Player::UnInit()
|
|||||||
delete pair.second;
|
delete pair.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (auto& pair : apply_hash_) {
|
||||||
|
delete pair.second;
|
||||||
|
}
|
||||||
friend_hash_.clear();
|
friend_hash_.clear();
|
||||||
NotifyOffline();
|
NotifyOffline();
|
||||||
}
|
}
|
||||||
@ -203,16 +202,13 @@ void Player::_CMFriendApplyList(f8::MsgHdr& hdr, const cs::CMFriendApplyList& ms
|
|||||||
apply.base_data.user_value2 = a8::XValue(row[9]);
|
apply.base_data.user_value2 = a8::XValue(row[9]);
|
||||||
apply.base_data.user_value3 = a8::XValue(row[10]);
|
apply.base_data.user_value3 = a8::XValue(row[10]);
|
||||||
hum->apply_list_.push_back(apply);
|
hum->apply_list_.push_back(apply);
|
||||||
#if 0
|
|
||||||
if (apply.idx > hum->last_apply_idx_) {
|
if (apply.idx > hum->last_apply_idx_) {
|
||||||
hum->last_apply_idx_ = apply.idx;
|
hum->last_apply_idx_ = apply.idx;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
cs::SMFriendApplyList respmsg;
|
cs::SMFriendApplyList respmsg;
|
||||||
hum->FillApplyList(*paging, respmsg);
|
hum->FillApplyList(*paging, respmsg);
|
||||||
hum->SendMsg(respmsg);
|
hum->SendMsg(respmsg);
|
||||||
hum->apply_list_.clear();
|
|
||||||
a8::UnSetBitFlag(hum->red_point_flags_, RPF_Apply);
|
a8::UnSetBitFlag(hum->red_point_flags_, RPF_Apply);
|
||||||
hum->SyncRedPoint();
|
hum->SyncRedPoint();
|
||||||
}
|
}
|
||||||
@ -303,6 +299,7 @@ void Player::_CMFriendAgree(f8::MsgHdr& hdr, const cs::CMFriendAgree& msg)
|
|||||||
AccountId(),
|
AccountId(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
ClearApplyByTarget(msg.apply().target_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMFriendRefuse(f8::MsgHdr& hdr, const cs::CMFriendRefuse& msg)
|
void Player::_CMFriendRefuse(f8::MsgHdr& hdr, const cs::CMFriendRefuse& msg)
|
||||||
@ -318,6 +315,7 @@ void Player::_CMFriendRefuse(f8::MsgHdr& hdr, const cs::CMFriendRefuse& msg)
|
|||||||
AccountId(),
|
AccountId(),
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
ClearApplyByIdx(msg.apply().idx());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
|
void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
|
||||||
@ -1061,3 +1059,30 @@ void Player::OnDailyReset()
|
|||||||
{
|
{
|
||||||
role_data.today_apply_times = 0;
|
role_data.today_apply_times = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::RecalcRedPoint()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::ClearApplyByIdx(long long idx)
|
||||||
|
{
|
||||||
|
auto itr = apply_hash_.find(idx);
|
||||||
|
if (itr != apply_hash_.end()) {
|
||||||
|
delete itr->second;
|
||||||
|
apply_hash_.erase(itr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::ClearApplyByTarget(const std::string& target_id)
|
||||||
|
{
|
||||||
|
std::vector<long long> deleted_applys;
|
||||||
|
for (auto& pair : apply_hash_) {
|
||||||
|
if (pair.second->target_id == target_id) {
|
||||||
|
deleted_applys.push_back(pair.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto idx : deleted_applys) {
|
||||||
|
ClearApplyByIdx(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -130,6 +130,9 @@ private:
|
|||||||
bool CanAddFriend(const std::string& account_id);
|
bool CanAddFriend(const std::string& account_id);
|
||||||
void SyncRedPoint();
|
void SyncRedPoint();
|
||||||
void OnDailyReset();
|
void OnDailyReset();
|
||||||
|
void RecalcRedPoint();
|
||||||
|
void ClearApplyByIdx(long long idx);
|
||||||
|
void ClearApplyByTarget(const std::string& target_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool dirty_ = false;
|
bool dirty_ = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user