This commit is contained in:
aozhiwei 2023-12-27 19:13:51 +08:00
parent c4cae288f4
commit cc2da01509
3 changed files with 16 additions and 0 deletions

View File

@ -35,6 +35,11 @@ int MobaBattle::GetMemberNum()
return member_id_hash_.size();
}
int MobaBattle::GetTeamNum()
{
return uuid_hash_.size();
}
void MobaBattle::TraverseMemberList(std::function<bool (MobaMember*)> func)
{
for (auto& pair : member_id_hash_) {

View File

@ -26,6 +26,7 @@ class MobaBattle
std::shared_ptr<MobaTeam> GetTeamByTeamUuid(const std::string& team_uuid);
bool AllIsJoined();
int GetMemberNum();
int GetTeamNum();
void TraverseMemberList(std::function<bool (MobaMember*)> func);
private:

View File

@ -1170,6 +1170,16 @@ void RoomMgr::_CMJoinMoba(f8::MsgHdr* hdr, const cs::CMJoin& msg)
if (!member) {
return;
}
if (p->GetTeamNum() < 0 ||
p->GetTeamNum() > 2) {
return;
}
p->TraverseMemberList
(
[] (MobaMember* m) -> bool
{
return true;
});
};
SendGetMobaBattleData(join_msg, cb);
}