This commit is contained in:
aozhiwei 2024-01-30 21:34:08 +08:00
parent 3a5cd46128
commit a058ce092d
3 changed files with 20 additions and 1 deletions

View File

@ -141,3 +141,12 @@ void CustomBattle::TraverseMemberList(std::function<bool (CustomMember*)> func)
}
}
}
void CustomBattle::TraverseTeamList(std::function<bool (std::shared_ptr<CustomTeam>)> cb)
{
for (auto& pair : uuid_hash_) {
if (!cb(pair.second)) {
break;
}
}
}

View File

@ -29,6 +29,7 @@ class CustomBattle
int GetMemberNum();
int GetTeamNum();
void TraverseMemberList(std::function<bool (CustomMember*)> func);
void TraverseTeamList(std::function<bool (std::shared_ptr<CustomTeam>)> cb);
private:
bool parse_ok_ = false;

View File

@ -50,6 +50,9 @@
#include "roommgr.h"
#include "bornpoint.h"
#include "roomob.h"
#include "custom_battle.h"
#include "custom_team.h"
#include "custom_member.h"
#include "mt/Param.h"
#include "mt/Buff.h"
@ -2704,7 +2707,13 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
int Room::InitWithCustomBattle(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,
std::shared_ptr<CustomBattle> p)
{
std::vector<std::shared_ptr<CustomTeam>> teams;
p->TraverseTeamList
(
[&teams] (std::shared_ptr<CustomTeam> team) -> bool
{
return true;
});
}
void SyncObject::FillSMSyncPosition(cs::SMSyncPosition& sync_msg)