This commit is contained in:
aozhiwei 2019-04-10 16:07:39 +08:00
parent 047b93a50e
commit 521c1e25f6
3 changed files with 13 additions and 0 deletions

View File

@ -13,9 +13,14 @@
#include "building.h" #include "building.h"
#include "loot.h" #include "loot.h"
#include "collision.h" #include "collision.h"
#include "roommgr.h"
const int ROOM_MAX_PLAYER_NUM = 50; const int ROOM_MAX_PLAYER_NUM = 50;
#if 1
const int ANDROID_NUM = 0;
#else
const int ANDROID_NUM = 10; const int ANDROID_NUM = 10;
#endif
void Room::Update(int delta_time) 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_old = gas_data.old_area_meta->i->rad();
gas_data.rad_new = gas_data.new_area_meta->i->rad(); gas_data.rad_new = gas_data.new_area_meta->i->rad();
RoomMgr::Instance()->RemoveFromInactiveRoomHash(room_uuid);
} }
} }
break; break;

View File

@ -44,6 +44,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
} }
room->map_meta = MetaMgr::Instance()->GetMap(1001); room->map_meta = MetaMgr::Instance()->GetMap(1001);
room->ShuaAndroid(); room->ShuaAndroid();
inactive_room_hash_[room->room_uuid] = room;
room_hash_[room->room_uuid] = room; room_hash_[room->room_uuid] = room;
} }
unsigned short new_uniid = room->AllocUniid(); unsigned short new_uniid = room->AllocUniid();
@ -88,3 +89,8 @@ Room* RoomMgr::GetRoomByUuid(long long uuid)
auto itr = room_hash_.find(uuid); auto itr = room_hash_.find(uuid);
return itr != room_hash_.end() ? itr->second : nullptr; return itr != room_hash_.end() ? itr->second : nullptr;
} }
void RoomMgr::RemoveFromInactiveRoomHash(long long room_uuid)
{
inactive_room_hash_.erase(room_uuid);
}

View File

@ -21,6 +21,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
void Update(int delta_time); void Update(int delta_time);
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg); void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
void RemoveFromInactiveRoomHash(long long room_uuid);
private: private:
Room* GetJoinableRoom(const std::string& account_id); Room* GetJoinableRoom(const std::string& account_id);