diff --git a/server/gameserver/custom_battle.cc b/server/gameserver/custom_battle.cc index d380e567..4bb62481 100644 --- a/server/gameserver/custom_battle.cc +++ b/server/gameserver/custom_battle.cc @@ -33,7 +33,7 @@ void CustomBattle::ParseResult(a8::XObject& obj) start_time_ = obj.Get("start_time"); sign_ = obj.Get("sign").GetString(); const mt::Map* map_meta = mt::Map::GetById(map_id_); - if (!map_meta) { + if (!map_meta || !map_meta->IsOpen()) { parse_ok_ = false; return; } @@ -215,3 +215,8 @@ void CustomBattle::TraverseObList(std::function GetTeamByAccountId(const std::string& account_id); diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index e99fc8c6..cb45dc80 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -331,6 +331,7 @@ std::shared_ptr RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, proto_version, channel, msg.mapid(), + (RoomMode_e)msg.room_mode(), nullptr); } @@ -517,6 +518,7 @@ std::shared_ptr RoomMgr::CreateRoom(const cs::CMJoin& msg, int creator_proto_version, int creator_channel, int map_id, + RoomMode_e room_mode, std::shared_ptr custom_battle) { int room_idx = AllocRoomIdx(); @@ -1047,7 +1049,8 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu register_time, join_msg->proto_version(), channel, - msg.mapid(), + p->GetMapId(), + p->GetRoomMode(), nullptr); } else { room = RoomMgr::Instance()->CreateRoom @@ -1057,7 +1060,8 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu register_time, join_msg->proto_version(), channel, - msg.mapid(), + p->GetMapId(), + p->GetRoomMode(), nullptr); } } @@ -1072,7 +1076,8 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu register_time, join_msg->proto_version(), channel, - msg.mapid(), + p->GetMapId(), + p->GetRoomMode(), p); } else { room = RoomMgr::Instance()->CreateRoom @@ -1082,7 +1087,8 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu register_time, join_msg->proto_version(), channel, - msg.mapid(), + p->GetMapId(), + p->GetRoomMode(), nullptr); } p->SetRoom(room.get()); diff --git a/server/gameserver/roommgr.h b/server/gameserver/roommgr.h index 12cfa015..ab919ad5 100644 --- a/server/gameserver/roommgr.h +++ b/server/gameserver/roommgr.h @@ -114,6 +114,7 @@ class RoomMgr : public a8::Singleton int creator_proto_version, int creator_channel, int map_id, + RoomMode_e room_mode, std::shared_ptr custom_battle); void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle); std::string GenTeamHashData(const std::string& team_uuid, std::map* team_hash);