修复合并问题
This commit is contained in:
parent
0670c384d8
commit
56655f41fb
@ -1212,7 +1212,9 @@ void Room::CombineTeam()
|
|||||||
for (auto& pair : team_hash_) {
|
for (auto& pair : team_hash_) {
|
||||||
for (Human* hum : pair.second) {
|
for (Human* hum : pair.second) {
|
||||||
if (hum->auto_fill && !hum->team_uuid.empty()) {
|
if (hum->auto_fill && !hum->team_uuid.empty()) {
|
||||||
|
if (first_team_id == 0) {
|
||||||
first_team_id = pair.first;
|
first_team_id = pair.first;
|
||||||
|
}
|
||||||
need_combine_teams[pair.first] = pair.second.size();
|
need_combine_teams[pair.first] = pair.second.size();
|
||||||
total_count += pair.second.size();
|
total_count += pair.second.size();
|
||||||
break;
|
break;
|
||||||
@ -1266,6 +1268,7 @@ void Room::CombineTeam()
|
|||||||
}
|
}
|
||||||
if (team_id1 != team_id2) {
|
if (team_id1 != team_id2) {
|
||||||
if (pair1.second + pair2.second <= MAX_TEAM_NUM) {
|
if (pair1.second + pair2.second <= MAX_TEAM_NUM) {
|
||||||
|
int new_team_num = pair1.second + pair2.second;
|
||||||
{
|
{
|
||||||
std::set<Human*>& team1_members = team_hash_[team_id1];
|
std::set<Human*>& team1_members = team_hash_[team_id1];
|
||||||
std::set<Human*>& team2_members = team_hash_[team_id2];
|
std::set<Human*>& team2_members = team_hash_[team_id2];
|
||||||
@ -1290,6 +1293,8 @@ void Room::CombineTeam()
|
|||||||
if (pair1.second + pair2.second >= first_team_num) {
|
if (pair1.second + pair2.second >= first_team_num) {
|
||||||
need_combine_teams.erase(team_id1);
|
need_combine_teams.erase(team_id1);
|
||||||
need_combine_teams_copy.erase(team_id1);
|
need_combine_teams_copy.erase(team_id1);
|
||||||
|
} else {
|
||||||
|
pair1.second = new_team_num;
|
||||||
}
|
}
|
||||||
need_combine_teams.erase(team_id2);
|
need_combine_teams.erase(team_id2);
|
||||||
need_combine_teams_copy.erase(team_id2);
|
need_combine_teams_copy.erase(team_id2);
|
||||||
@ -1300,6 +1305,8 @@ void Room::CombineTeam()
|
|||||||
if (pair1.second + pair2.second >= MAX_TEAM_NUM) {
|
if (pair1.second + pair2.second >= MAX_TEAM_NUM) {
|
||||||
need_combine_teams.erase(team_id1);
|
need_combine_teams.erase(team_id1);
|
||||||
need_combine_teams_copy.erase(team_id1);
|
need_combine_teams_copy.erase(team_id1);
|
||||||
|
} else {
|
||||||
|
pair1.second = new_team_num;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
need_combine_teams.erase(team_id1);
|
need_combine_teams.erase(team_id1);
|
||||||
@ -1307,6 +1314,8 @@ void Room::CombineTeam()
|
|||||||
if (pair1.second + pair2.second >= MAX_TEAM_NUM) {
|
if (pair1.second + pair2.second >= MAX_TEAM_NUM) {
|
||||||
need_combine_teams.erase(team_id2);
|
need_combine_teams.erase(team_id2);
|
||||||
need_combine_teams_copy.erase(team_id2);
|
need_combine_teams_copy.erase(team_id2);
|
||||||
|
} else {
|
||||||
|
pair2.second = new_team_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user