1
This commit is contained in:
parent
61946d50bf
commit
d58a670d5e
@ -45,6 +45,9 @@ void Android::Update(int delta_time)
|
||||
if (room->frame_no % 2 == 0) {
|
||||
SendUpdateMsg();
|
||||
}
|
||||
if (!real_dead) {
|
||||
room->IncRealAliveCount();
|
||||
}
|
||||
++updated_times_;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ static void SavePerfLog()
|
||||
{
|
||||
a8::UdpLog::Instance()->Info
|
||||
("mainloop_rundelay:%d room_num:%d player_num:%d online_num:%d alive_count:%d "
|
||||
"sys_request_delay:%d user_request_delay:%d http_pending_num:%d active_count:%d",
|
||||
"sys_request_delay:%d user_request_delay:%d http_pending_num:%d real_alive_count:%d",
|
||||
{
|
||||
App::Instance()->perf.max_run_delay_time,
|
||||
RoomMgr::Instance()->RoomNum(),
|
||||
@ -66,7 +66,7 @@ static void SavePerfLog()
|
||||
f8::HttpClientPool::Instance()->max_sys_request_delay,
|
||||
f8::HttpClientPool::Instance()->max_user_request_delay,
|
||||
f8::HttpClientPool::Instance()->GetPendingNum(),
|
||||
App::Instance()->perf.active_count
|
||||
App::Instance()->perf.real_alive_count
|
||||
});
|
||||
App::Instance()->perf.max_run_delay_time = 0;
|
||||
App::Instance()->perf.max_dispatchmsg_time = 0;
|
||||
|
@ -48,6 +48,9 @@ void Player::Update(int delta_time)
|
||||
if (room->frame_no % 2 == 0) {
|
||||
SendUpdateMsg();
|
||||
}
|
||||
if (!real_dead) {
|
||||
room->IncRealAliveCount();
|
||||
}
|
||||
++updated_times_;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,8 @@ Player* Room::GetPlayerByAccountId(const std::string& accountid)
|
||||
Player* Room::GetPlayerByUniId(int uniid)
|
||||
{
|
||||
Entity* entity = GetEntityByUniId(uniid);
|
||||
return entity && entity->entity_type == ET_Player && entity->entity_subtype == EST_Player ? (Player*)entity : nullptr;
|
||||
return entity && entity->entity_type == ET_Player && entity->entity_subtype == EST_Player ?
|
||||
(Player*)entity : nullptr;
|
||||
}
|
||||
|
||||
Entity* Room::GetEntityByUniId(int uniid)
|
||||
@ -134,11 +135,6 @@ int Room::AliveCount()
|
||||
return alive_count_;
|
||||
}
|
||||
|
||||
int Room::RealAliveCount()
|
||||
{
|
||||
return real_alive_count_;
|
||||
}
|
||||
|
||||
int Room::ActiveCount()
|
||||
{
|
||||
return active_count_;
|
||||
|
@ -73,7 +73,8 @@ public:
|
||||
void Update(int delta_time);
|
||||
int GetPlayerNum();
|
||||
int AliveCount();
|
||||
inline int RealAliveCount();
|
||||
inline int RealAliveCount() { return real_alive_count_; }
|
||||
inline void IncRealAliveCount() { ++real_alive_count_; }
|
||||
int ActiveCount();
|
||||
Player* GetPlayerByAccountId(const std::string& accountid);
|
||||
Player* GetPlayerByUniId(int uniid);
|
||||
|
@ -62,9 +62,13 @@ void RoomMgr::UnInit()
|
||||
|
||||
void RoomMgr::Update(int delta_time)
|
||||
{
|
||||
long long real_alive_count = 0;
|
||||
for (auto& pair : room_hash_) {
|
||||
pair.second->Update(delta_time);
|
||||
Room* room = pair.second;
|
||||
room->Update(delta_time);
|
||||
real_alive_count += room->RealAliveCount();
|
||||
}
|
||||
App::Instance()->perf.real_alive_count = real_alive_count;
|
||||
}
|
||||
|
||||
void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user