This commit is contained in:
aozhiwei 2024-02-04 10:56:32 +08:00
parent 5b8ec57bbe
commit 11711a219d
2 changed files with 4 additions and 4 deletions

View File

@ -2014,10 +2014,10 @@ void Room::FillTeam()
std::vector<std::shared_ptr<Team>> free_team_list; std::vector<std::shared_ptr<Team>> free_team_list;
TraverseTeams TraverseTeams
( (
[] (Team* ele_team) -> bool [&free_team_list] (Team* ele_team) -> bool
{ {
if (ele_team->IsFreeTeam()) { if (ele_team->IsFreeTeam()) {
free_team_list.push_back(ele_team); free_team_list.push_back(ele_team->shared_from_this());
} }
return true; return true;
}); });
@ -2055,7 +2055,7 @@ void Room::FillTeam()
{ {
ele_team->GenBattleUuid(); ele_team->GenBattleUuid();
if (ele_team->HasPlayer()) { if (ele_team->HasPlayer()) {
batch_sync_->AddTeam(ele_team.get()); batch_sync_->AddTeam(ele_team);
} }
return true; return true;
}); });

View File

@ -12,7 +12,7 @@ namespace a8
class Room; class Room;
class Human; class Human;
class Team class Team : public std::enable_shared_from_this<Team>
{ {
public: public:
Room* room = nullptr; Room* room = nullptr;