This commit is contained in:
aozhiwei 2023-11-04 11:38:34 +08:00
parent 6d7805223f
commit de8af0c10f

View File

@ -299,21 +299,21 @@ void MatchTeam::SyncMatchInfo()
void MatchTeam::TryCombineTeam()
{
if (HaveEmptySlot()) {
MatchTeam* matched_team = nullptr;
std::shared_ptr<MatchTeam> matched_team;
MatchMgr::Instance()->TraverseTeam
(
[this, &matched_team] (MatchTeam* team, bool& stop)
[this, &matched_team] (std::shared_ptr<MatchTeam>& team, bool& stop)
{
if (team == this) {
if (team.get() == this) {
return;
}
if (CanCombine(team)) {
if (CanCombine(team.get())) {
matched_team = team;
stop = true;
}
});
if (matched_team) {
Combine(matched_team);
Combine(matched_team.get());
}
}
}
@ -638,7 +638,7 @@ void MatchTeam::StartGame()
auto cb =
[team_uuid] (std::vector<std::shared_ptr<BattleDataContext>>& results)
{
MatchTeam* team = MatchMgr::Instance()->GetTeam(team_uuid);
auto team = MatchMgr::Instance()->GetTeam(team_uuid);
if (team) {
for (auto context : results) {
bool found = false;
@ -656,7 +656,7 @@ void MatchTeam::StartGame()
abort();
}
}
RoomMgr::Instance()->JoinTeam(team);
RoomMgr::Instance()->JoinTeam(team.get());
team->RemoveTeam();
}
};