This commit is contained in:
aozhiwei 2023-09-20 19:10:10 +08:00
parent 3823588f9a
commit 48e506aa91
2 changed files with 17 additions and 11 deletions

View File

@ -6,7 +6,7 @@ class CustomMember
public: public:
const std::string& GetAccountId() { return account_id_; } const std::string& GetAccountId() { return account_id_; }
std::shared_ptr<BattleDataContext>& GetBattleContext() { return battle_context_; }; std::shared_ptr<BattleDataContext>& GetNetData() { return battle_context_; };
private: private:
std::string account_id_; std::string account_id_;

View File

@ -19,6 +19,8 @@
#include "mapmgr.h" #include "mapmgr.h"
#include "debugcmd.h" #include "debugcmd.h"
#include "custom_battle.h" #include "custom_battle.h"
#include "custom_team.h"
#include "custom_member.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Text.h" #include "mt/Text.h"
@ -864,6 +866,16 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr& hdr, const cs::CMJoin& msg)
RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle); RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle);
return; return;
} }
auto team = p->GetTeamByAccountId(msg.account_id());
if (!team) {
RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle);
return;
}
auto member = team->GetMember(msg.account_id());
if (!member) {
RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle);
return;
}
if (!p->CanAdd(join_msg->account_id(), join_msg->session_id())) { if (!p->CanAdd(join_msg->account_id(), join_msg->session_id())) {
RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle); RoomMgr::Instance()->JoinErrorHandle(*join_msg, 2, socket_handle);
return; return;
@ -884,13 +896,9 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr& hdr, const cs::CMJoin& msg)
#if 0 #if 0
hum->hero_uniid = a8::XValue(msg.hero_uniid()); hum->hero_uniid = a8::XValue(msg.hero_uniid());
#endif #endif
#if 0 hum->battle_uuid = member->GetNetData()->battle_uuid;
hum->battle_uuid = results.at(0)->battle_uuid; hum->is_valid_battle = member->GetNetData()->is_valid_battle;
#endif hum->payload = member->GetNetData()->payload;
#if 0
hum->is_valid_battle = results.at(0)->is_valid_battle;
hum->payload = results.at(0)->payload;
#endif
PlayerMgr::Instance()-> PlayerMgr::Instance()->
CreatePlayerByCMJoin(hum, CreatePlayerByCMJoin(hum,
0, //ip_saddr, 0, //ip_saddr,
@ -902,9 +910,7 @@ void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr& hdr, const cs::CMJoin& msg)
hum->meta = mt::Param::s().human_meta; hum->meta = mt::Param::s().human_meta;
} }
hum->room = p->GetRoom(); hum->room = p->GetRoom();
#if 0 hum->SetBattleContext(member->GetNetData());
hum->SetBattleContext(results.at(0));
#endif
hum->GetBattleContext()->Init(hum); hum->GetBattleContext()->Init(hum);
{ {
long long hero_uniid = 0; long long hero_uniid = 0;