This commit is contained in:
aozhiwei 2024-02-02 16:18:17 +08:00
parent 18367b8c17
commit 88797a0fa6

View File

@ -1704,16 +1704,27 @@ bool Room::GenSmallCircle()
void Room::MatchTeam(Human* hum)
{
if (!hum->team_uuid.empty()) {
for (auto& pair : human_hash_) {
if (pair.second != hum) {
if (pair.second->team_uuid == hum->team_uuid) {
if (pair.second->GetTeam() && !pair.second->GetTeam()->IsFull()) {
pair.second->GetTeam()->AddMember(hum);
return;
}
}
{
bool match_ok = false;
TraverseHumanList
(
[&match_ok, hum] (Human* ele_hum) -> bool
{
if (ele_hum != hum) {
if (ele_hum->team_uuid == hum->team_uuid) {
if (ele_hum->GetTeam() && !ele_hum->GetTeam()->IsFull()) {
ele_hum->GetTeam()->AddMember(hum);
match_ok = true;
return false;
}
}
}
return true;
});
if (match_ok) {
return;
}
}//end for human_hash_
}
if (mt::Param::s().prebattle_combine_team) {
if (!hum->GetTeam() && hum->auto_fill && combineable_team_hash_.size() > 1) {
for (auto& pair : combineable_team_hash_) {