diff --git a/server/gameserver/mapmgr.cc b/server/gameserver/mapmgr.cc index 8a1b5b9..3642d04 100644 --- a/server/gameserver/mapmgr.cc +++ b/server/gameserver/mapmgr.cc @@ -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() diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index cc4e3ca..d5c3f02 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -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);