This commit is contained in:
aozhiwei 2024-03-18 20:02:22 +08:00
parent e99af3f4ac
commit 22e8a2e551
4 changed files with 18 additions and 5 deletions

View File

@ -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<bool (std::shared_ptr<CustomMemb
}
}
}
RoomMode_e CustomBattle::GetRoomMode()
{
return kPvpMode;
}

View File

@ -23,6 +23,7 @@ class CustomBattle
int GetZoneId() { return zone_id_; }
int GetNodeId() { return zone_id_; }
int GetMapId() { return map_id_; }
RoomMode_e GetRoomMode();
int GetStartTime() { return start_time_; }
void ParseResult(a8::XObject& obj);
std::shared_ptr<CustomTeam> GetTeamByAccountId(const std::string& account_id);

View File

@ -331,6 +331,7 @@ std::shared_ptr<Room> RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
proto_version,
channel,
msg.mapid(),
(RoomMode_e)msg.room_mode(),
nullptr);
}
@ -517,6 +518,7 @@ std::shared_ptr<Room> RoomMgr::CreateRoom(const cs::CMJoin& msg,
int creator_proto_version,
int creator_channel,
int map_id,
RoomMode_e room_mode,
std::shared_ptr<CustomBattle> 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());

View File

@ -114,6 +114,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
int creator_proto_version,
int creator_channel,
int map_id,
RoomMode_e room_mode,
std::shared_ptr<CustomBattle> custom_battle);
void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle);
std::string GenTeamHashData(const std::string& team_uuid, std::map<std::string, std::string>* team_hash);