This commit is contained in:
azw 2023-11-10 11:30:26 +00:00
parent fe6587fdc7
commit f58185b947
2 changed files with 11 additions and 0 deletions

View File

@ -213,6 +213,16 @@ std::shared_ptr<GSNode> GSMgr::GetNodeByNodeKey(const std::string& node_key)
return itr != node_key_hash_.end() ? itr->second : nullptr;
}
std::shared_ptr<GSNode> GSMgr::GetNodeByInstanceId(int instance_id)
{
for (auto& pair : node_key_hash_) {
if (pair.second->instance_id == instance_id) {
return pair.second;
}
}
return nullptr;
}
std::shared_ptr<GSNode> GSMgr::AllocNode()
{
std::vector<std::shared_ptr<GSNode>>* sorted_nodes = GetSortedNodes();

View File

@ -32,6 +32,7 @@ class GSMgr : public a8::Singleton<GSMgr>
private:
std::shared_ptr<GSNode> GetNodeByTeamId(const std::string& team_id);
std::shared_ptr<GSNode> GetNodeByNodeKey(const std::string& node_key);
std::shared_ptr<GSNode> GetNodeByInstanceId(int instance_id);
std::shared_ptr<GSNode> AllocNode();
void RearrangeNode();
void AddNodeToSortedNodes(std::shared_ptr<GSNode> node);