diff --git a/server/gameserver/roomob.cc b/server/gameserver/roomob.cc index a29ce04a..e16eae05 100644 --- a/server/gameserver/roomob.cc +++ b/server/gameserver/roomob.cc @@ -28,3 +28,9 @@ Player* RoomOb::GetByAccountId(const std::string& account_id) auto itr = id_hash_.find(account_id); return itr != id_hash_.end() ? itr->second : nullptr; } + +Player* RoomOb::GetBySocket(int socket_handle) +{ + auto itr = socket_hash_.find(socket_handle); + return itr != socket_hash_.end() ? itr->second : nullptr; +} diff --git a/server/gameserver/roomob.h b/server/gameserver/roomob.h index 16b759f7..51655e70 100644 --- a/server/gameserver/roomob.h +++ b/server/gameserver/roomob.h @@ -13,8 +13,10 @@ class RoomOb : public std::enable_shared_from_this void UnInit(); Player* GetByAccountId(const std::string& account_id); + Player* GetBySocket(int socket_handle); private: Room* room_ = nullptr; std::map id_hash_; + std::map socket_hash_; };