1
This commit is contained in:
parent
ed6a817056
commit
8be61c1810
@ -48,3 +48,12 @@ void MobaBattle::TraverseMemberList(std::function<bool (MobaMember*)> func)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MobaBattle::TraverseTeam(std::function<bool (std::shared_ptr<MobaTeam>)> cb)
|
||||
{
|
||||
for (auto& pair : uuid_hash_) {
|
||||
if (!cb(pair.second)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ class MobaBattle
|
||||
int GetMemberNum();
|
||||
int GetTeamNum();
|
||||
void TraverseMemberList(std::function<bool (MobaMember*)> func);
|
||||
void TraverseTeam(std::function<bool (std::shared_ptr<MobaTeam>)> cb);
|
||||
|
||||
private:
|
||||
bool parse_ok_ = false;
|
||||
|
@ -2244,6 +2244,14 @@ void Room::NotifyKillList(const std::vector<int>& uniid_list)
|
||||
int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,
|
||||
std::shared_ptr<MobaBattle> p)
|
||||
{
|
||||
std::vector<std::shared_ptr<MobaTeam>> moba_teams;
|
||||
p->TraverseTeam
|
||||
(
|
||||
[&moba_teams] (std::shared_ptr<MobaTeam> team) -> bool
|
||||
{
|
||||
moba_teams.push_back(team);
|
||||
return true;
|
||||
});
|
||||
p->TraverseMemberList
|
||||
(
|
||||
[p, msg, ip_saddr, socket_handle] (MobaMember* m) -> bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user