This commit is contained in:
aozhiwei 2024-01-29 22:19:04 +08:00
parent 6095167478
commit e7c340d53a
2 changed files with 10 additions and 1 deletions

View File

@ -22,3 +22,9 @@ void RoomOb::UnInit()
{
}
Player* RoomOb::GetByAccountId(const std::string& account_id)
{
auto itr = id_hash_.find(account_id);
return itr != id_hash_.end() ? itr->second : nullptr;
}

View File

@ -1,6 +1,7 @@
#pragma once
class Room;
class Player;
class RoomOb : public std::enable_shared_from_this<RoomOb>
{
@ -11,7 +12,9 @@ class RoomOb : public std::enable_shared_from_this<RoomOb>
void Init();
void UnInit();
Player* GetByAccountId(const std::string& account_id);
private:
Room* room_ = nullptr;
std::map<std::string, Player*> id_hash_;
};