1
This commit is contained in:
parent
2408f952be
commit
5128fde9fb
@ -1117,7 +1117,9 @@ void Player::ProcessEventTimerFunc()
|
|||||||
{
|
{
|
||||||
std::string account_id = param.sender.GetString();
|
std::string account_id = param.sender.GetString();
|
||||||
long long curr_max_event_idx = param.param1;
|
long long curr_max_event_idx = param.param1;
|
||||||
|
#if 0
|
||||||
long long last_event_idx = param.param2;
|
long long last_event_idx = param.param2;
|
||||||
|
#endif
|
||||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(account_id);
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(account_id);
|
||||||
if (hum) {
|
if (hum) {
|
||||||
hum->event_fetching_ = false;
|
hum->event_fetching_ = false;
|
||||||
@ -1249,20 +1251,10 @@ bool Player::CanAddFriend(const std::string& account_id)
|
|||||||
if (GetFriendById(account_id)) {
|
if (GetFriendById(account_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int target_channel = f8::ExtractChannelIdFromAccountId(account_id);
|
|
||||||
int target_gameid = f8::ExtractGameIdFromAccountId(account_id);
|
int target_gameid = f8::ExtractGameIdFromAccountId(account_id);
|
||||||
int self_channel = f8::ExtractChannelIdFromAccountId(AccountId());
|
if (target_gameid != gameid) {
|
||||||
int self_gameid = f8::ExtractGameIdFromAccountId(AccountId());
|
|
||||||
if (target_gameid != self_gameid) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (self_channel != 6000 && target_channel != 6000) {
|
|
||||||
if (self_channel != target_channel) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ class Player
|
|||||||
|
|
||||||
Friend myself;
|
Friend myself;
|
||||||
RoleData role_data;
|
RoleData role_data;
|
||||||
|
int gameid = 0;
|
||||||
|
int channel = 0;
|
||||||
long ip_saddr = 0;
|
long ip_saddr = 0;
|
||||||
int account_registertime = 0;
|
int account_registertime = 0;
|
||||||
|
|
||||||
|
@ -144,6 +144,8 @@ void PlayerMgr::_SS_IM_PushUserOnlineState(f8::MsgHdr& hdr, const ss::SS_IM_Push
|
|||||||
|
|
||||||
void PlayerMgr::_SS_IM_RandomUsersRequest(f8::MsgHdr& hdr, const ss::SS_IM_RandomUsersRequest& msg)
|
void PlayerMgr::_SS_IM_RandomUsersRequest(f8::MsgHdr& hdr, const ss::SS_IM_RandomUsersRequest& msg)
|
||||||
{
|
{
|
||||||
|
int gameid = f8::ExtractGameIdFromAccountId
|
||||||
|
(msg.context().user_info().base_data().account_id());
|
||||||
std::set<std::string> exclude_account_ids;
|
std::set<std::string> exclude_account_ids;
|
||||||
for (auto& account_id : msg.exclude_account_ids()) {
|
for (auto& account_id : msg.exclude_account_ids()) {
|
||||||
exclude_account_ids.insert(account_id);
|
exclude_account_ids.insert(account_id);
|
||||||
@ -151,8 +153,13 @@ void PlayerMgr::_SS_IM_RandomUsersRequest(f8::MsgHdr& hdr, const ss::SS_IM_Rando
|
|||||||
std::vector<Player*> human_list;
|
std::vector<Player*> human_list;
|
||||||
human_list.reserve(100);
|
human_list.reserve(100);
|
||||||
for (auto& pair : accountid_hash_) {
|
for (auto& pair : accountid_hash_) {
|
||||||
|
if (human_list.size() > 100) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (pair.second->GetFriendNum() < MAX_FRIEND_NUM &&
|
if (pair.second->GetFriendNum() < MAX_FRIEND_NUM &&
|
||||||
exclude_account_ids.find(pair.second->AccountId()) == exclude_account_ids.end()) {
|
pair.second->gameid == gameid &&
|
||||||
|
exclude_account_ids.find(pair.second->AccountId()) == exclude_account_ids.end()
|
||||||
|
) {
|
||||||
human_list.push_back(pair.second);
|
human_list.push_back(pair.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -470,6 +477,8 @@ void PlayerMgr::AsyncLoginOnOk(const std::string& account_id,
|
|||||||
hum = new Player();
|
hum = new Player();
|
||||||
hum->socket_handle = hdr->socket_handle;
|
hum->socket_handle = hdr->socket_handle;
|
||||||
hum->ip_saddr = hdr->ip_saddr;
|
hum->ip_saddr = hdr->ip_saddr;
|
||||||
|
hum->gameid = f8::ExtractGameIdFromAccountId(account_id);
|
||||||
|
hum->channel = f8::ExtractChannelIdFromAccountId(account_id);
|
||||||
hum->myself.base_data.account_id = account_id;
|
hum->myself.base_data.account_id = account_id;
|
||||||
hum->myself.base_data.nickname = nickname;
|
hum->myself.base_data.nickname = nickname;
|
||||||
hum->myself.base_data.avatar_url = avatar_url;
|
hum->myself.base_data.avatar_url = avatar_url;
|
||||||
@ -550,4 +559,3 @@ void PlayerMgr::OnClientSocketDisconnect(int socket_handle)
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user