This commit is contained in:
aozhiwei 2020-05-29 14:07:18 +08:00
parent af44f89f9b
commit c69b492f58
2 changed files with 19 additions and 18 deletions

View File

@ -54,24 +54,6 @@ 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

@ -48,6 +48,24 @@ void Room::Init()
xtimer.Init(RoomXGetTickCount, this, 100, 100);
xtimer_attacher_.xtimer = &xtimer;
#ifdef DEBUG
{
xtimer.AddRepeatTimer
(
SERVER_FRAME_RATE * 3,
a8::XParams()
.SetSender(this),
[] (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
CreateSpawnPoints();
CreateLoots();
@ -59,6 +77,7 @@ void Room::Init()
void Room::UnInit()
{
App::Instance()->perf.alive_count -= alive_count_;
timer_attacher.ClearTimerList();
xtimer_attacher_.ClearTimerList();
for (auto& pair : accountid_hash_) {
PlayerMgr::Instance()->RemovePlayerBySocket(pair.second->socket_handle);