This commit is contained in:
aozhiwei 2021-09-29 05:56:19 +00:00
parent ddef0aba08
commit f7048dd6c6
2 changed files with 15 additions and 3 deletions

View File

@ -255,7 +255,7 @@ void MatchTeam::UpdateMaster()
TryCombineTeam(); TryCombineTeam();
} }
} }
if (phase_left_time_ <= 0) { if (phase_left_time_ <= 0 || GetPredictMemberNum() >= MAX_TEAM_NUM) {
ChooseLeader(); ChooseLeader();
phase_ = kMatchChoose; phase_ = kMatchChoose;
phase_start_tick_ = a8::XGetTickCount(); phase_start_tick_ = a8::XGetTickCount();
@ -276,8 +276,8 @@ void MatchTeam::UpdateMaster()
} }
} }
} }
if (phase_left_time_ <= MetaMgr::Instance()->match_lock_time) { if ((phase_left_time_ <= MetaMgr::Instance()->match_lock_time) || IsAllPrepare()) {
for (int i = 0; i < 4; ++i) { for (int i = 0; i < MAX_TEAM_NUM; ++i) {
AutoChoose(true); AutoChoose(true);
} }
for (auto& member : curr_member_hash_) { for (auto& member : curr_member_hash_) {
@ -539,3 +539,14 @@ void MatchTeam::AutoChoose(bool force)
} }
} }
} }
bool MatchTeam::IsAllPrepare()
{
int num = 0;
for (auto& member : curr_member_hash_) {
if (member->state == kMatchPrepare) {
++num;
}
}
return num >= MAX_TEAM_NUM;
}

View File

@ -84,6 +84,7 @@ class MatchTeam
void StartGame(); void StartGame();
void ChooseLeader(); void ChooseLeader();
void AutoChoose(bool force = false); void AutoChoose(bool force = false);
bool IsAllPrepare();
private: private:
long long phase_start_tick_ = 0; long long phase_start_tick_ = 0;