From 521c1e25f6d25a49a70184753e3a76740ce5d8c8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 10 Apr 2019 16:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=BA=BAOk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/room.cc | 6 ++++++ server/gameserver/roommgr.cc | 6 ++++++ server/gameserver/roommgr.h | 1 + 3 files changed, 13 insertions(+) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 23c429b..043eff7 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -13,9 +13,14 @@ #include "building.h" #include "loot.h" #include "collision.h" +#include "roommgr.h" const int ROOM_MAX_PLAYER_NUM = 50; +#if 1 +const int ANDROID_NUM = 0; +#else const int ANDROID_NUM = 10; +#endif void Room::Update(int delta_time) { @@ -558,6 +563,7 @@ void Room::UpdateGas() } gas_data.rad_old = gas_data.old_area_meta->i->rad(); gas_data.rad_new = gas_data.new_area_meta->i->rad(); + RoomMgr::Instance()->RemoveFromInactiveRoomHash(room_uuid); } } break; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index d872c74..2d644cd 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -44,6 +44,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg) } room->map_meta = MetaMgr::Instance()->GetMap(1001); room->ShuaAndroid(); + inactive_room_hash_[room->room_uuid] = room; room_hash_[room->room_uuid] = room; } unsigned short new_uniid = room->AllocUniid(); @@ -88,3 +89,8 @@ Room* RoomMgr::GetRoomByUuid(long long uuid) auto itr = room_hash_.find(uuid); return itr != room_hash_.end() ? itr->second : nullptr; } + +void RoomMgr::RemoveFromInactiveRoomHash(long long room_uuid) +{ + inactive_room_hash_.erase(room_uuid); +} diff --git a/server/gameserver/roommgr.h b/server/gameserver/roommgr.h index a17afd4..58c6fa1 100644 --- a/server/gameserver/roommgr.h +++ b/server/gameserver/roommgr.h @@ -21,6 +21,7 @@ class RoomMgr : public a8::Singleton void Update(int delta_time); void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg); + void RemoveFromInactiveRoomHash(long long room_uuid); private: Room* GetJoinableRoom(const std::string& account_id);