1
This commit is contained in:
parent
72ae5463c3
commit
c2c48e5746
@ -26,7 +26,7 @@ const int HUM_NUM_DOWN_LIMIT = 2500;
|
||||
|
||||
struct JoinRequest
|
||||
{
|
||||
int socket_handle = 0;
|
||||
f8::MsgHdr hdr;
|
||||
cs::CMJoin msg;
|
||||
};
|
||||
|
||||
@ -154,53 +154,6 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
return;
|
||||
}
|
||||
|
||||
int game_times = 0;
|
||||
RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
|
||||
if (self_room_type < RT_OldBrid1) {
|
||||
self_room_type = RT_OldBrid1;
|
||||
}
|
||||
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
|
||||
int proto_version = msg.proto_version();
|
||||
int channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
|
||||
Room* room = GetJoinableRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
register_time,
|
||||
proto_version,
|
||||
channel
|
||||
);
|
||||
if (!room) {
|
||||
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
||||
return;
|
||||
}
|
||||
Player* hum = room->NewPlayer();
|
||||
hum->ProcPreSettlementInfo(msg.pre_settlement_info());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
hdr.ip_saddr,
|
||||
hdr.socket_handle,
|
||||
msg
|
||||
);
|
||||
hum->meta = MetaMgr::Instance()->GetPlayer(msg.hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = MetaMgr::Instance()->human_meta;
|
||||
}
|
||||
hum->room = room;
|
||||
room->AddPlayer(hum);
|
||||
hum->ProcPrepareItems(msg.prepare_items());
|
||||
hum->ProcPrepareItems2(msg.prepare_items2());
|
||||
hum->ProcSkillList(msg.skill_list());
|
||||
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||
if (JsonDataMgr::Instance()->channel != 0 &&
|
||||
JsonDataMgr::Instance()->channel != channel) {
|
||||
a8::UdpLog::Instance()->Warning
|
||||
("join room channel not match channel:%d account_id:%s",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel,
|
||||
msg.account_id()
|
||||
});
|
||||
}
|
||||
OnJoinRoomOk(msg, hum);
|
||||
}
|
||||
|
||||
void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
||||
@ -702,3 +655,56 @@ void RoomMgr::TeamRoomTimeOut(const std::string& team_uuid)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void RoomMgr::OnJoinResponse(JoinRequest* req)
|
||||
{
|
||||
f8::MsgHdr& hdr = req->hdr;
|
||||
cs::CMJoin& msg = req->msg;
|
||||
int game_times = 0;
|
||||
RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
|
||||
if (self_room_type < RT_OldBrid1) {
|
||||
self_room_type = RT_OldBrid1;
|
||||
}
|
||||
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
|
||||
int proto_version = msg.proto_version();
|
||||
int channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
|
||||
Room* room = GetJoinableRoom(msg,
|
||||
self_room_type,
|
||||
game_times,
|
||||
register_time,
|
||||
proto_version,
|
||||
channel
|
||||
);
|
||||
if (!room) {
|
||||
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
||||
return;
|
||||
}
|
||||
Player* hum = room->NewPlayer();
|
||||
hum->ProcPreSettlementInfo(msg.pre_settlement_info());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
hdr.ip_saddr,
|
||||
hdr.socket_handle,
|
||||
msg
|
||||
);
|
||||
hum->meta = MetaMgr::Instance()->GetPlayer(msg.hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = MetaMgr::Instance()->human_meta;
|
||||
}
|
||||
hum->room = room;
|
||||
room->AddPlayer(hum);
|
||||
hum->ProcPrepareItems(msg.prepare_items());
|
||||
hum->ProcPrepareItems2(msg.prepare_items2());
|
||||
hum->ProcSkillList(msg.skill_list());
|
||||
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||
if (JsonDataMgr::Instance()->channel != 0 &&
|
||||
JsonDataMgr::Instance()->channel != channel) {
|
||||
a8::UdpLog::Instance()->Warning
|
||||
("join room channel not match channel:%d account_id:%s",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel,
|
||||
msg.account_id()
|
||||
});
|
||||
}
|
||||
OnJoinRoomOk(msg, hum);
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
std::string GenTeamHashData(const std::string& team_uuid, std::map<std::string, long long>* team_hash);
|
||||
void OnJoinRoomOk(const cs::CMJoin& msg, Player* hum);
|
||||
void TeamRoomTimeOut(const std::string& team_uuid);
|
||||
void OnJoinResponse(JoinRequest* req);
|
||||
|
||||
private:
|
||||
int current_room_idx_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user