This commit is contained in:
aozhiwei 2024-02-02 16:08:18 +08:00
parent 99dfdb022a
commit 734c4d958c

View File

@ -1092,14 +1092,18 @@ bool Room::CanJoin(const std::string& accountid,
GetHumanNum() >= GetRoomMaxPlayerNum() GetHumanNum() >= GetRoomMaxPlayerNum()
) { ) {
bool have_team = false; bool have_team = false;
for (auto& pair : human_hash_) { TraverseHumanList
if (pair.second->team_uuid == msg.team_uuid()) { (
if (pair.second->GetTeam() && !pair.second->GetTeam()->IsFull()) { [&have_team, &msg] (Human* ele_hum) -> bool
have_team = true; {
break; if (ele_hum->team_uuid == msg.team_uuid()) {
} if (ele_hum->GetTeam() && !ele_hum->GetTeam()->IsFull()) {
} have_team = true;
}//end for human_hash_ return false;
}
}
return true;
});
if (have_team) { if (have_team) {
while (GetHumanNum() >= GetRoomMaxPlayerNum()) { while (GetHumanNum() >= GetRoomMaxPlayerNum()) {
RandRemoveAndroid(); RandRemoveAndroid();