This commit is contained in:
aozhiwei 2024-05-17 16:39:28 +08:00
parent 0aed0c6c0e
commit ea26404c2b
3 changed files with 6 additions and 17 deletions

View File

@ -165,6 +165,11 @@ void App::ProcessGameGateMsg(f8::MsgHdr* hdr)
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr->socket_handle);
if (hum) {
hdr->hum = hum;
#ifdef MYDEBUG
if (hum->GetSocketHandle() != hdr->socket_handle) {
A8_ABORT();
}
#endif
ProcessNetMsg(handler, hum, hdr);
}
}

View File

@ -149,8 +149,6 @@ static Player* InternalCreatePlayer(std::shared_ptr<CustomBattle> p,
hum->payload = m->GetNetData()->payload;
PlayerMgr::Instance()->
CreatePlayerByCustomMember(hum,
0,
0,
m
);
hum->meta = mt::Hero::GetById(m->GetNetData()->GetHeroId());
@ -2425,19 +2423,8 @@ void GGListener::ForceCloseChildSocket(int sockhandle)
}
Player* PlayerMgr::CreatePlayerByCustomMember(Player* hum,
long ip_saddr,
int socket,
std::shared_ptr<CustomMember> member)
{
#ifdef MYDEBUG
a8::XPrintf("CreatePlayerByCustomMember account_id:%s socket_handle:%d\n",
{
hum->account_id,
socket,
});
#endif
hum->SetSocketHandle(socket);
hum->SetIpSaddr(ip_saddr);
hum->account_id = member->GetAccountId();
hum->session_id = member->GetSessionId();
hum->name = member->GetName();
@ -2469,9 +2456,6 @@ Player* PlayerMgr::CreatePlayerByCustomMember(Player* hum,
}
}
#endif
if (socket) {
socket_hash_[socket] = hum;
}
return hum;
}

View File

@ -32,7 +32,7 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
int OnlineNum();
Player* GetPlayerBySocket(int socket);
Player* CreatePlayerByCustomMember(Player* hum, long ip_saddr, int socket,
Player* CreatePlayerByCustomMember(Player* hum,
std::shared_ptr<CustomMember> member);
size_t GetAccountNum() { return account_num_hash_.size(); }
void IncAccountNum(const std::string& account_id);