diff --git a/server/gameserver/custom_battle.cc b/server/gameserver/custom_battle.cc index 1f44fb06..76bae224 100644 --- a/server/gameserver/custom_battle.cc +++ b/server/gameserver/custom_battle.cc @@ -124,3 +124,12 @@ int CustomBattle::GetMemberNum() { return member_id_hash_.size(); } + +void CustomBattle::TraverseMemberList(std::function func) +{ + for (auto& pair : member_id_hash_) { + if (!func(pair.second.get())) { + break; + } + } +} diff --git a/server/gameserver/custom_battle.h b/server/gameserver/custom_battle.h index a078d84a..acdaa48a 100644 --- a/server/gameserver/custom_battle.h +++ b/server/gameserver/custom_battle.h @@ -26,6 +26,7 @@ class CustomBattle std::shared_ptr GetTeamByTeamUuid(const std::string& team_uuid); bool AllIsJoined(); int GetMemberNum(); + void TraverseMemberList(std::function func); private: bool parse_ok_ = false;