This commit is contained in:
aozhiwei 2020-05-29 10:49:13 +08:00
parent 31839aa7ae
commit ccdbbe98fa
2 changed files with 19 additions and 18 deletions

View File

@ -54,6 +54,24 @@ void MapMgr::AttachRoom(Room* room)
room->loots = &loots_;
room->buildings = &buildings_;
room->map_meta = map_meta_;
#ifdef DEBUG
{
room->xtimer.AddRepeatTimer
(
SERVER_FRAME_RATE,
a8::XParams()
.SetSender(room),
[] (const a8::XParams& param)
{
Room* room = (Room*)param.sender.GetUserData();
a8::UdpLog::Instance()->Debug("room_idx:%d real_alive_count:%d",
{
room->room_idx,
room->RealAliveCount()
});
});
}
#endif
}
void MapMgr::CreateThings()

View File

@ -19,7 +19,7 @@
#include "framework/cpp/utils.h"
const int ROOM_NUM_UP_LIMIT = 900;
const int HUM_NUM_DOWN_LIMIT = 1000;
const int HUM_NUM_DOWN_LIMIT = 1200;
static RoomType_e GetHumanRoomType(const cs::CMJoin& msg)
{
@ -69,30 +69,13 @@ void RoomMgr::UnInit()
void RoomMgr::Update(int delta_time)
{
#ifdef DEBUG
static long long last_tick = 0;
#endif
long long real_alive_count = 0;
for (auto& pair : room_hash_) {
Room* room = pair.second;
room->Update(delta_time);
real_alive_count += room->RealAliveCount();
#ifdef DEBUG
if (a8::XGetTickCount() - last_tick > 1000 * 1) {
a8::UdpLog::Instance()->Debug("room_idx:%d real_alive_count:%d",
{
room->room_idx,
room->RealAliveCount()
});
}
#endif
}
App::Instance()->perf.real_alive_count = real_alive_count;
#ifdef DEBUG
if (a8::XGetTickCount() - last_tick > 1000 * 1) {
last_tick = a8::XGetTickCount();
}
#endif
}
void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)