This commit is contained in:
aozhiwei 2021-09-30 07:44:44 +00:00
parent 6d435c5f7a
commit c83a969a84
2 changed files with 26 additions and 12 deletions

View File

@ -440,6 +440,16 @@ bool MatchTeam::CanCombine(MatchTeam* b)
#endif #endif
return false; return false;
} }
if (GetValidSocketNum() <= 0) {
#ifdef DEBUG
a8::XPrintf("CanCombine 21\n", {});
#endif
}
if (b->GetValidSocketNum() <= 0) {
#ifdef DEBUG
a8::XPrintf("CanCombine 22\n", {});
#endif
}
if (HasSameCurrMember(b)) { if (HasSameCurrMember(b)) {
#ifdef DEBUG #ifdef DEBUG
a8::XPrintf("CanCombine 11\n", {}); a8::XPrintf("CanCombine 11\n", {});
@ -513,19 +523,9 @@ void MatchTeam::ShuaRobot()
void MatchTeam::StartGame() void MatchTeam::StartGame()
{ {
{ if (GetValidSocketNum() > 0) {
int valid_socket_num = 0;
for (auto& member : curr_member_hash_) {
if (member->socket_handle != 0) {
if (MatchMgr::Instance()->GetMatchInfo(member->socket_handle)) {
++valid_socket_num;
}
}
}
if (valid_socket_num > 0) {
RoomMgr::Instance()->JoinTeam(this); RoomMgr::Instance()->JoinTeam(this);
} }
}
for (auto& member : curr_member_hash_) { for (auto& member : curr_member_hash_) {
if (member->socket_handle != 0) { if (member->socket_handle != 0) {
MatchMgr::Instance()->RemoveSocket(member->socket_handle); MatchMgr::Instance()->RemoveSocket(member->socket_handle);
@ -657,3 +657,16 @@ void MatchTeam::AutoPrepare()
} }
} }
} }
int MatchTeam::GetValidSocketNum()
{
int valid_socket_num = 0;
for (auto& member : curr_member_hash_) {
if (member->socket_handle != 0) {
if (MatchMgr::Instance()->GetMatchInfo(member->socket_handle)) {
++valid_socket_num;
}
}
}
return valid_socket_num;
}

View File

@ -88,6 +88,7 @@ class MatchTeam
void UpdateTeamState(); void UpdateTeamState();
void CheckChoose(); void CheckChoose();
void CheckPrepare(); void CheckPrepare();
int GetValidSocketNum();
private: private:
long long phase_start_tick_ = 0; long long phase_start_tick_ = 0;