1
This commit is contained in:
parent
65137e50ea
commit
ad47449732
@ -1163,86 +1163,6 @@ int Room::GetTeamNum()
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Room::CanJoin(const std::string& accountid,
|
||||
RoomType_e self_room_type,
|
||||
RoomMode_e self_room_mode,
|
||||
int self_proto_version,
|
||||
int self_channel,
|
||||
int init_map_id,
|
||||
const cs::CMJoin& msg)
|
||||
{
|
||||
if (lock_room_) {
|
||||
return false;
|
||||
}
|
||||
if (IsCustomBattle()) {
|
||||
return false;
|
||||
}
|
||||
if (IsMobaModeRoom()) {
|
||||
return false;
|
||||
}
|
||||
if (room_mode_ != self_room_mode) {
|
||||
return false;
|
||||
}
|
||||
if (GetGasData().GetGasMode() != GasInactive) {
|
||||
return false;
|
||||
}
|
||||
#if 0
|
||||
if (pve_instance) {
|
||||
if (pve_instance->gemini_id() != msg.pve_instance_id()) {
|
||||
return false;
|
||||
}
|
||||
#if 1
|
||||
Team* team = GetAliveTeam();
|
||||
if (!team) {
|
||||
return false;
|
||||
}
|
||||
Human* hum = team->GetOneAliveMember(nullptr);
|
||||
if (!hum) {
|
||||
return false;
|
||||
}
|
||||
if (hum->team_uuid != msg.team_uuid()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (init_map_id != 0) {
|
||||
auto map_instance = MapMgr::Instance()->GetMapInstance(init_map_id);
|
||||
if (map_instance && map_instance->GetMapMeta()->map_mode() == room_mode_ &&
|
||||
map_instance->map_id != map_meta_->map_id()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (GetPlayerByAccountId(accountid)) {
|
||||
return false;
|
||||
}
|
||||
if (GetPlayerNum() < (int)GetRoomMaxPlayerNum() &&
|
||||
!msg.team_uuid().empty() &&
|
||||
GetHumanNum() >= GetRoomMaxPlayerNum()
|
||||
) {
|
||||
bool have_team = false;
|
||||
TraverseHumanList
|
||||
(
|
||||
[&have_team, &msg] (Human* ele_hum) -> bool
|
||||
{
|
||||
if (ele_hum->team_uuid == msg.team_uuid()) {
|
||||
if (ele_hum->GetTeam() && !ele_hum->GetTeam()->IsFull()) {
|
||||
have_team = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (have_team) {
|
||||
while (GetHumanNum() >= GetRoomMaxPlayerNum()) {
|
||||
RandRemoveAndroid();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GetPlayerNum() < (int)GetRoomMaxPlayerNum();
|
||||
}
|
||||
|
||||
void Room::OnPlayerOffline(Player* hum)
|
||||
{
|
||||
if (GetOnlinePlayerNum() <= 0 && game_over_timer.expired()) {
|
||||
@ -3863,6 +3783,9 @@ bool Room::CanJoin(std::shared_ptr<CustomBattle> p)
|
||||
if (map_meta_->map_id() != p->GetMapId()) {
|
||||
return false;
|
||||
}
|
||||
if (GetMapModeMeta()->id() != p->GetMapMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto p_team = p->GetTeamByIdx(0);
|
||||
if (GetPlayerNum() + p_team->GetMemberNum() > GetRoomMaxPlayerNum()) {
|
||||
|
@ -215,13 +215,6 @@ public:
|
||||
Team* GetAliveTeam();
|
||||
void TraverseTeams(std::function<bool (Team*)> cb);
|
||||
void TraverseRawTeams(std::function<bool (Team*)> cb);
|
||||
bool CanJoin(const std::string& accountid,
|
||||
RoomType_e self_roomm_type,
|
||||
RoomMode_e self_room_mode,
|
||||
int self_proto_version,
|
||||
int self_channel,
|
||||
int init_map_id,
|
||||
const cs::CMJoin& msg);
|
||||
bool CanJoin(std::shared_ptr<CustomBattle> p);
|
||||
void OnPlayerOffline(Player* hum);
|
||||
void FillSMUiUpdate(cs::SMUiUpdate& msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user