This commit is contained in:
aozhiwei 2024-03-17 10:52:10 +08:00
parent 0a50e4ae91
commit 45b58339cb
2 changed files with 41 additions and 21 deletions

View File

@ -334,6 +334,16 @@ std::shared_ptr<Room> RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
nullptr);
}
std::shared_ptr<Room> RoomMgr::GetJoinableRoom(std::shared_ptr<CustomBattle> custom_battle,
const RoomType_e self_room_type,
int game_times,
int creator_register_time,
int proto_version,
int channel)
{
return nullptr;
}
std::shared_ptr<Room> RoomMgr::GetRoomByUuid(const std::string& room_uuid)
{
auto itr = room_hash_.find(room_uuid);
@ -1015,29 +1025,33 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg, int cu
int proto_version = msg.proto_version();
int channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
std::shared_ptr<Room> room = nullptr;
if (p->IsPvp()) {
room = RoomMgr::Instance()->CreateRoom
(*join_msg,
self_room_type,
game_times,
register_time,
join_msg->proto_version(),
channel,
msg.mapid(),
p);
if (p->IsNormalMode()) {
} else {
room = RoomMgr::Instance()->CreateRoom
(*join_msg,
self_room_type,
game_times,
register_time,
join_msg->proto_version(),
channel,
msg.mapid(),
nullptr);
if (p->IsPvp()) {
room = RoomMgr::Instance()->CreateRoom
(*join_msg,
self_room_type,
game_times,
register_time,
join_msg->proto_version(),
channel,
msg.mapid(),
p);
} else {
room = RoomMgr::Instance()->CreateRoom
(*join_msg,
self_room_type,
game_times,
register_time,
join_msg->proto_version(),
channel,
msg.mapid(),
nullptr);
}
p->SetRoom(room.get());
room->InitWithCustomBattle(ip_saddr, socket_handle, join_msg, p);
}
p->SetRoom(room.get());
room->InitWithCustomBattle(ip_saddr, socket_handle, join_msg, p);
};
SendGetCustomBattleData(join_msg, cb, custom_room_type);
}

View File

@ -96,6 +96,12 @@ class RoomMgr : public a8::Singleton<RoomMgr>
int creator_register_time,
int proto_version,
int channel);
std::shared_ptr<Room> GetJoinableRoom(std::shared_ptr<CustomBattle> custom_battle,
const RoomType_e self_room_type,
int game_times,
int creator_register_time,
int proto_version,
int channel);
void ReportServerState(int instance_id, const std::string& host, int port);
void FreeOverRoom(const std::string& room_uuid);
bool IsLimitJoin();