This commit is contained in:
aozhiwei 2024-03-25 16:09:35 +08:00
parent 14fd195ef8
commit 0d3cd07a12
3 changed files with 16 additions and 5 deletions

View File

@ -274,3 +274,8 @@ std::shared_ptr<CustomTeam> CustomBattle::GetTeamByIdx(int idx)
}
return team_list_.at(idx);
}
void CustomBattle::OnEnter(std::shared_ptr<cs::CMJoin> join_msg, long ip_saddr, int socket_handle)
{
}

View File

@ -43,6 +43,7 @@ class CustomBattle
bool IsCustomMode() { return custom_room_type_ == CUSTOM_ROOM_CUSTOM; }
bool IsPvp() { return !is_moba_; }
bool IsMoba() { return is_moba_; }
void OnEnter(std::shared_ptr<cs::CMJoin> join_msg, long ip_saddr, int socket_handle);
private:
@ -68,4 +69,5 @@ private:
std::map<std::string, std::shared_ptr<CustomTeam>> account_hash_;
std::map<std::string, std::shared_ptr<CustomMember>> member_id_hash_;
std::map<std::string, std::shared_ptr<CustomMember>> ob_id_hash_;
std::map<int, std::shared_ptr<CustomMember>> socket_hash_;
};

View File

@ -513,6 +513,14 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu
return;
}
}
const mt::Map* map_meta = mt::Map::GetById(p->GetMapId());
if (!map_meta || !map_meta->IsOpen()) {
RoomMgr::Instance()->JoinErrorHandle(msg, 3, socket_handle);
return;
}
#if 1
p->OnEnter(join_msg, ip_saddr, socket_handle);
#else
if (p->GetRoom()) {
if (p->GetRoom()->GetGasData().GetGasMode() != GasInactive) {
return;
@ -523,11 +531,6 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu
}
return;
}
const mt::Map* map_meta = mt::Map::GetById(p->GetMapId());
if (!map_meta || !map_meta->IsOpen()) {
RoomMgr::Instance()->JoinErrorHandle(msg, 3, socket_handle);
return;
}
int game_times = 0;
RoomType_e self_room_type = p->GetRoomType();
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
@ -586,6 +589,7 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu
p->SetRoom(room.get());
room->InitWithCustomBattle(ip_saddr, socket_handle, join_msg, p);
}
#endif
};
SendGetCustomBattleData(join_msg, cb, custom_room_type);
}