diff --git a/server/gameserver/custom_battle.cc b/server/gameserver/custom_battle.cc index 22950766..7cdcbf42 100644 --- a/server/gameserver/custom_battle.cc +++ b/server/gameserver/custom_battle.cc @@ -274,3 +274,8 @@ std::shared_ptr CustomBattle::GetTeamByIdx(int idx) } return team_list_.at(idx); } + +void CustomBattle::OnEnter(std::shared_ptr join_msg, long ip_saddr, int socket_handle) +{ + +} diff --git a/server/gameserver/custom_battle.h b/server/gameserver/custom_battle.h index fca744fb..dbf134e3 100644 --- a/server/gameserver/custom_battle.h +++ b/server/gameserver/custom_battle.h @@ -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 join_msg, long ip_saddr, int socket_handle); private: @@ -68,4 +69,5 @@ private: std::map> account_hash_; std::map> member_id_hash_; std::map> ob_id_hash_; + std::map> socket_hash_; }; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 5d130442..9dbdc822 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -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); }