1
This commit is contained in:
parent
2b2b5315d5
commit
e757ceb022
@ -388,7 +388,7 @@ void App::DispatchMsg()
|
|||||||
switch (pdelnode->sockfrom) {
|
switch (pdelnode->sockfrom) {
|
||||||
case SF_GameGate:
|
case SF_GameGate:
|
||||||
{
|
{
|
||||||
ProcessGameGateMsg(hdr);
|
ProcessGameGateMsg(&hdr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -411,15 +411,15 @@ void App::DispatchMsg()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
void App::ProcessGameGateMsg(f8::MsgHdr* hdr)
|
||||||
{
|
{
|
||||||
if (hdr.msgid == ss::_SS_Ping) {
|
if (hdr->msgid == ss::_SS_Ping) {
|
||||||
ss::SS_Pong pongmsg;
|
ss::SS_Pong pongmsg;
|
||||||
GGListener::Instance()->SendProxyMsg(hdr.socket_handle, pongmsg);
|
GGListener::Instance()->SendProxyMsg(hdr->socket_handle, pongmsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
f8::NetMsgHandler* handler = f8::GetNetMsgHandler(&HandlerMgr::Instance()->ggmsghandler,
|
f8::NetMsgHandler* handler = f8::GetNetMsgHandler(&HandlerMgr::Instance()->ggmsghandler,
|
||||||
hdr.msgid);
|
hdr->msgid);
|
||||||
if (handler) {
|
if (handler) {
|
||||||
switch (handler->handlerid) {
|
switch (handler->handlerid) {
|
||||||
case HID_RoomMgr:
|
case HID_RoomMgr:
|
||||||
@ -427,7 +427,7 @@ void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
|||||||
break;
|
break;
|
||||||
case HID_MatchTeam:
|
case HID_MatchTeam:
|
||||||
{
|
{
|
||||||
auto match_info = MatchMgr::Instance()->GetMatchInfo(hdr.socket_handle);
|
auto match_info = MatchMgr::Instance()->GetMatchInfo(hdr->socket_handle);
|
||||||
if (match_info) {
|
if (match_info) {
|
||||||
ProcessNetMsg(handler, std::get<1>(*match_info).get(), hdr);
|
ProcessNetMsg(handler, std::get<1>(*match_info).get(), hdr);
|
||||||
}
|
}
|
||||||
@ -438,9 +438,9 @@ void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
|||||||
break;
|
break;
|
||||||
case HID_Player:
|
case HID_Player:
|
||||||
{
|
{
|
||||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr.socket_handle);
|
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr->socket_handle);
|
||||||
if (hum) {
|
if (hum) {
|
||||||
hdr.hum = hum;
|
hdr->hum = hum;
|
||||||
ProcessNetMsg(handler, hum, hdr);
|
ProcessNetMsg(handler, hum, hdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ private:
|
|||||||
|
|
||||||
void DispatchMsg();
|
void DispatchMsg();
|
||||||
|
|
||||||
void ProcessGameGateMsg(f8::MsgHdr& hdr);
|
void ProcessGameGateMsg(f8::MsgHdr* hdr);
|
||||||
|
|
||||||
void InitLog();
|
void InitLog();
|
||||||
void UnInitLog();
|
void UnInitLog();
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "mt/Robot.h"
|
#include "mt/Robot.h"
|
||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
|
|
||||||
void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||||
{
|
{
|
||||||
#ifndef MYDEBUG
|
#ifndef MYDEBUG
|
||||||
return;
|
return;
|
||||||
|
@ -22,50 +22,50 @@
|
|||||||
|
|
||||||
static void _GMOpsSelfChecking(std::shared_ptr<f8::JsonHttpRequest> request)
|
static void _GMOpsSelfChecking(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||||
{
|
{
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
request->resp_xobj->SetVal("healthy", 1);
|
request->GetResp()->SetVal("healthy", 1);
|
||||||
request->resp_xobj->SetVal("servicing", App::Instance()->IsServicing() ? 1 : 0);
|
request->GetResp()->SetVal("servicing", App::Instance()->IsServicing() ? 1 : 0);
|
||||||
request->resp_xobj->SetVal("max_rundelay", PerfMonitor::Instance()->max_run_delay_time);
|
request->GetResp()->SetVal("max_rundelay", PerfMonitor::Instance()->max_run_delay_time);
|
||||||
request->resp_xobj->SetVal("max_timer_idle", PerfMonitor::Instance()->max_timer_idle);
|
request->GetResp()->SetVal("max_timer_idle", PerfMonitor::Instance()->max_timer_idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _GMOpsStopService(std::shared_ptr<f8::JsonHttpRequest> request)
|
static void _GMOpsStopService(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||||
{
|
{
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
App::Instance()->SetServicing(false);
|
App::Instance()->SetServicing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _GMOpsStartService(std::shared_ptr<f8::JsonHttpRequest> request)
|
static void _GMOpsStartService(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||||
{
|
{
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
App::Instance()->SetServicing(true);
|
App::Instance()->SetServicing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _GMOpsServerInfo(std::shared_ptr<f8::JsonHttpRequest> request)
|
static void _GMOpsServerInfo(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||||
{
|
{
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
request->resp_xobj->SetVal("node_id", App::Instance()->GetNodeId());
|
request->GetResp()->SetVal("node_id", App::Instance()->GetNodeId());
|
||||||
request->resp_xobj->SetVal("instance_id", App::Instance()->GetInstanceId());
|
request->GetResp()->SetVal("instance_id", App::Instance()->GetInstanceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _GMOpsTerminate(std::shared_ptr<f8::JsonHttpRequest> request)
|
static void _GMOpsTerminate(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||||
{
|
{
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
App::Instance()->Terminate();
|
App::Instance()->Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _GMStatGetRealTimeOnline(std::shared_ptr<f8::JsonHttpRequest> request)
|
static void _GMStatGetRealTimeOnline(std::shared_ptr<f8::JsonHttpRequest> request)
|
||||||
{
|
{
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
request->resp_xobj->SetVal("num", PerfMonitor::Instance()->entity_num[ET_Player]);
|
request->GetResp()->SetVal("num", PerfMonitor::Instance()->entity_num[ET_Player]);
|
||||||
request->resp_xobj->SetVal("room_num", RoomMgr::Instance()->RoomNum());
|
request->GetResp()->SetVal("room_num", RoomMgr::Instance()->RoomNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlerMgr::Init()
|
void HandlerMgr::Init()
|
||||||
@ -148,20 +148,22 @@ void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
|||||||
std::string msgname = a8::Get(request, "c").GetString() + "@" + a8::Get(request, "a").GetString();
|
std::string msgname = a8::Get(request, "c").GetString() + "@" + a8::Get(request, "a").GetString();
|
||||||
auto itr = gmhandlers_.find(msgname);
|
auto itr = gmhandlers_.find(msgname);
|
||||||
if (itr != gmhandlers_.end()) {
|
if (itr != gmhandlers_.end()) {
|
||||||
|
#if 0
|
||||||
auto request = std::make_shared<f8::JsonHttpRequest>();
|
auto request = std::make_shared<f8::JsonHttpRequest>();
|
||||||
request->saddr = saddr;
|
request->saddr = saddr;
|
||||||
request->socket_handle = sockhandle;
|
request->socket_handle = sockhandle;
|
||||||
request->query_str = querystr;
|
request->query_str = querystr;
|
||||||
request->params->ReadFromUrlQueryString(querystr);
|
request->params->ReadFromUrlQueryString(querystr);
|
||||||
request->resp_xobj->SetVal("errcode", 0);
|
request->GetResp()->SetVal("errcode", 0);
|
||||||
request->resp_xobj->SetVal("errmsg", "");
|
request->GetResp()->SetVal("errmsg", "");
|
||||||
itr->second(request);
|
itr->second(request);
|
||||||
|
|
||||||
if (!request->pending){
|
if (!request->pending){
|
||||||
std::string response;
|
std::string response;
|
||||||
request->resp_xobj->ToJsonStr(response);
|
request->GetResp()->ToJsonStr(response);
|
||||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse(response));
|
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse(response));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse("{}"));
|
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse("{}"));
|
||||||
}
|
}
|
||||||
|
@ -27,24 +27,24 @@ static void _ProxyCallback(std::shared_ptr<f8::JsonHttpRequest> request)
|
|||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
f8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s",
|
f8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s",
|
||||||
{
|
{
|
||||||
request->params->ToJsonStr()
|
request->GetParams()->ToJsonStr()
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
std::string seq_id = request->params->Get("seq_id");
|
std::string seq_id = request->GetParams()->Get("seq_id");
|
||||||
std::shared_ptr<HttpProxyRequest> req = HttpProxy::Instance()->GetRequest(seq_id);
|
std::shared_ptr<HttpProxyRequest> req = HttpProxy::Instance()->GetRequest(seq_id);
|
||||||
if (req) {
|
if (req) {
|
||||||
a8::XObject data;
|
a8::XObject data;
|
||||||
|
|
||||||
data.ReadFromJsonString(request->params->Get("data").GetString());
|
data.ReadFromJsonString(request->GetParams()->Get("data").GetString());
|
||||||
if (data.GetType() == a8::XOT_SIMPLE) {
|
if (data.GetType() == a8::XOT_SIMPLE) {
|
||||||
data.ReadFromJsonString("{}");
|
data.ReadFromJsonString("{}");
|
||||||
}
|
}
|
||||||
f8::HttpContext ctx;
|
f8::HttpContext ctx;
|
||||||
if (request->params->HasKey("errcode") &&
|
if (request->GetParams()->HasKey("errcode") &&
|
||||||
request->params->Get("errcode").GetInt() == 0) {
|
request->GetParams()->Get("errcode").GetInt() == 0) {
|
||||||
req->cb(true, &data, &ctx);
|
req->cb(true, &data, &ctx);
|
||||||
} else {
|
} else {
|
||||||
req->cb(false, request->params.get(), &ctx);
|
req->cb(false, request->GetParams().get(), &ctx);
|
||||||
}
|
}
|
||||||
HttpProxy::Instance()->DestoryRequest(req);
|
HttpProxy::Instance()->DestoryRequest(req);
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ void MatchMgr::UnInit()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void MatchMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
{
|
{
|
||||||
std::string data = f8::PbToJson(&msg);
|
std::string data = f8::PbToJson(&msg);
|
||||||
a8::XPrintf("CMJoin socket_handle:%d members_size:%d %s\n", {hdr.socket_handle, msg.team_members().size(), data});
|
a8::XPrintf("CMJoin socket_handle:%d members_size:%d %s\n", {hdr->socket_handle, msg.team_members().size(), data});
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!NeedMatch(msg)) {
|
if (!NeedMatch(msg)) {
|
||||||
@ -41,12 +41,12 @@ void MatchMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
cs::SMShowTeamUI notifymsg;
|
cs::SMShowTeamUI notifymsg;
|
||||||
GGListener::Instance()->SendToClient(hdr.socket_handle, 0, notifymsg);
|
GGListener::Instance()->SendToClient(hdr->socket_handle, 0, notifymsg);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
cs::SMJoinedNotify notifymsg;
|
cs::SMJoinedNotify notifymsg;
|
||||||
notifymsg.set_error_code(0);
|
notifymsg.set_error_code(0);
|
||||||
GGListener::Instance()->SendToClient(hdr.socket_handle, 0, notifymsg);
|
GGListener::Instance()->SendToClient(hdr->socket_handle, 0, notifymsg);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto team = GetTeam(msg.team_uuid());
|
auto team = GetTeam(msg.team_uuid());
|
||||||
@ -67,7 +67,7 @@ void MatchMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
}
|
}
|
||||||
team->AddRawMember(hdr, msg);
|
team->AddRawMember(hdr, msg);
|
||||||
}
|
}
|
||||||
socket_hash_[hdr.socket_handle] = std::make_tuple(msg.account_id(), team);
|
socket_hash_[hdr->socket_handle] = std::make_tuple(msg.account_id(), team);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
|
||||||
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void _CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
void TraverseTeam(std::function<void (std::shared_ptr<MatchTeam>&, bool&)> func);
|
void TraverseTeam(std::function<void (std::shared_ptr<MatchTeam>&, bool&)> func);
|
||||||
|
|
||||||
bool NeedMatch(const cs::CMJoin& msg);
|
bool NeedMatch(const cs::CMJoin& msg);
|
||||||
|
@ -24,7 +24,7 @@ void MatchPool::UnInit()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchPool::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void MatchPool::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
|
||||||
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void _CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ MatchTeam::~MatchTeam()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void MatchTeam::Init(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
master_team_ = this;
|
master_team_ = this;
|
||||||
create_tick_ = a8::XGetTickCount();
|
create_tick_ = a8::XGetTickCount();
|
||||||
@ -87,19 +87,19 @@ void MatchTeam::Init(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
AddRawMember(hdr, msg);
|
AddRawMember(hdr, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::_CMMatchCancel(f8::MsgHdr& hdr, const cs::CMMatchCancel& msg)
|
void MatchTeam::_CMMatchCancel(f8::MsgHdr* hdr, const cs::CMMatchCancel& msg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
|
void MatchTeam::_CMMatchChoose(f8::MsgHdr* hdr, const cs::CMMatchChoose& msg)
|
||||||
{
|
{
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
a8::XPrintf("cmmatchchoose %s phase_:%d %s\n", {hdr.socket_handle, phase_, GetTeamUUid()});
|
a8::XPrintf("cmmatchchoose %s phase_:%d %s\n", {hdr->socket_handle, phase_, GetTeamUUid()});
|
||||||
{
|
{
|
||||||
for (auto& pair : raw_member_hash_) {
|
for (auto& pair : raw_member_hash_) {
|
||||||
a8::XPrintf("cmmatchchoose member %d:%d:%s %s:%d\n",
|
a8::XPrintf("cmmatchchoose member %d:%d:%s %s:%d\n",
|
||||||
{
|
{
|
||||||
hdr.socket_handle,
|
hdr->socket_handle,
|
||||||
phase_,
|
phase_,
|
||||||
GetTeamUUid(),
|
GetTeamUUid(),
|
||||||
pair.second->msg->account_id(),
|
pair.second->msg->account_id(),
|
||||||
@ -108,7 +108,7 @@ void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
auto member = GetMemberBySocket(hdr.socket_handle);
|
auto member = GetMemberBySocket(hdr->socket_handle);
|
||||||
if (member && master_team_->phase_ == kMatchChoose) {
|
if (member && master_team_->phase_ == kMatchChoose) {
|
||||||
member->msg->set_hero_id(msg.hero_id());
|
member->msg->set_hero_id(msg.hero_id());
|
||||||
member->msg->set_hero_uniid(msg.hero_uniid());
|
member->msg->set_hero_uniid(msg.hero_uniid());
|
||||||
@ -120,10 +120,10 @@ void MatchTeam::_CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::_CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& msg)
|
void MatchTeam::_CMMatchStartGame(f8::MsgHdr* hdr, const cs::CMMatchStartGame& msg)
|
||||||
{
|
{
|
||||||
if (master_team_->phase_ == kMatchChoose) {
|
if (master_team_->phase_ == kMatchChoose) {
|
||||||
auto member = GetMemberBySocket(hdr.socket_handle);
|
auto member = GetMemberBySocket(hdr->socket_handle);
|
||||||
if (member) {
|
if (member) {
|
||||||
member->state = kMatchPrepare;
|
member->state = kMatchPrepare;
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
@ -133,10 +133,10 @@ void MatchTeam::_CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::_CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancelStartGame& msg)
|
void MatchTeam::_CMMatchCancelStartGame(f8::MsgHdr* hdr, const cs::CMMatchCancelStartGame& msg)
|
||||||
{
|
{
|
||||||
if (master_team_->phase_ == kMatchChoose) {
|
if (master_team_->phase_ == kMatchChoose) {
|
||||||
auto member = GetMemberBySocket(hdr.socket_handle);
|
auto member = GetMemberBySocket(hdr->socket_handle);
|
||||||
if (member) {
|
if (member) {
|
||||||
member->state = kMatchReadying;
|
member->state = kMatchReadying;
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
@ -146,9 +146,9 @@ void MatchTeam::_CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::_CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg)
|
void MatchTeam::_CMMatchSendMsg(f8::MsgHdr* hdr, const cs::CMMatchSendMsg& msg)
|
||||||
{
|
{
|
||||||
auto sender = GetMemberBySocket(hdr.socket_handle);
|
auto sender = GetMemberBySocket(hdr->socket_handle);
|
||||||
if (sender) {
|
if (sender) {
|
||||||
for (auto member : master_team_->curr_member_hash_) {
|
for (auto member : master_team_->curr_member_hash_) {
|
||||||
if (member->socket_handle != 0) {
|
if (member->socket_handle != 0) {
|
||||||
@ -170,9 +170,9 @@ void MatchTeam::_CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::_CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcastMsg& msg)
|
void MatchTeam::_CMMatchBroadcastMsg(f8::MsgHdr* hdr, const cs::CMMatchBroadcastMsg& msg)
|
||||||
{
|
{
|
||||||
auto sender = GetMemberBySocket(hdr.socket_handle);
|
auto sender = GetMemberBySocket(hdr->socket_handle);
|
||||||
if (sender) {
|
if (sender) {
|
||||||
for (auto member : master_team_->curr_member_hash_) {
|
for (auto member : master_team_->curr_member_hash_) {
|
||||||
if (member->socket_handle != 0) {
|
if (member->socket_handle != 0) {
|
||||||
@ -188,12 +188,12 @@ void MatchTeam::_CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcast
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchTeam::AddRawMember(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void MatchTeam::AddRawMember(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
std::shared_ptr<RawTeamMember> member = std::make_shared<RawTeamMember>();
|
std::shared_ptr<RawTeamMember> member = std::make_shared<RawTeamMember>();
|
||||||
member->team = this;
|
member->team = this;
|
||||||
member->add_tick = a8::XGetTickCount();
|
member->add_tick = a8::XGetTickCount();
|
||||||
member->socket_handle = hdr.socket_handle;
|
member->socket_handle = hdr->socket_handle;
|
||||||
*member->msg = msg;
|
*member->msg = msg;
|
||||||
raw_member_hash_[msg.account_id()] = member;
|
raw_member_hash_[msg.account_id()] = member;
|
||||||
curr_member_hash_.push_back(member);
|
curr_member_hash_.push_back(member);
|
||||||
|
@ -66,16 +66,16 @@ class MatchTeam
|
|||||||
f8::Attacher timer_attacher;
|
f8::Attacher timer_attacher;
|
||||||
~MatchTeam();
|
~MatchTeam();
|
||||||
|
|
||||||
void Init(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void Init(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
|
|
||||||
void _CMMatchCancel(f8::MsgHdr& hdr, const cs::CMMatchCancel& msg);
|
void _CMMatchCancel(f8::MsgHdr* hdr, const cs::CMMatchCancel& msg);
|
||||||
void _CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg);
|
void _CMMatchChoose(f8::MsgHdr* hdr, const cs::CMMatchChoose& msg);
|
||||||
void _CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& msg);
|
void _CMMatchStartGame(f8::MsgHdr* hdr, const cs::CMMatchStartGame& msg);
|
||||||
void _CMMatchCancelStartGame(f8::MsgHdr& hdr, const cs::CMMatchCancelStartGame& msg);
|
void _CMMatchCancelStartGame(f8::MsgHdr* hdr, const cs::CMMatchCancelStartGame& msg);
|
||||||
void _CMMatchSendMsg(f8::MsgHdr& hdr, const cs::CMMatchSendMsg& msg);
|
void _CMMatchSendMsg(f8::MsgHdr* hdr, const cs::CMMatchSendMsg& msg);
|
||||||
void _CMMatchBroadcastMsg(f8::MsgHdr& hdr, const cs::CMMatchBroadcastMsg& msg);
|
void _CMMatchBroadcastMsg(f8::MsgHdr* hdr, const cs::CMMatchBroadcastMsg& msg);
|
||||||
|
|
||||||
void AddRawMember(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void AddRawMember(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
bool IsRawMember(const std::string& account_id);
|
bool IsRawMember(const std::string& account_id);
|
||||||
bool IsValidMember(const cs::CMJoin& msg);
|
bool IsValidMember(const cs::CMJoin& msg);
|
||||||
void TryCombineTeam();
|
void TryCombineTeam();
|
||||||
|
@ -2032,28 +2032,28 @@ Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
|
|||||||
return hum;
|
return hum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMgr::_SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_SocketDisconnect& msg)
|
void PlayerMgr::_SS_WSP_SocketDisconnect(f8::MsgHdr* hdr, const ss::SS_WSP_SocketDisconnect& msg)
|
||||||
{
|
{
|
||||||
Player* hum = GetPlayerBySocket(hdr.socket_handle);
|
Player* hum = GetPlayerBySocket(hdr->socket_handle);
|
||||||
if (hum) {
|
if (hum) {
|
||||||
RemovePlayerBySocket(hdr.socket_handle);
|
RemovePlayerBySocket(hdr->socket_handle);
|
||||||
hum->room->OnPlayerOffline(hum);
|
hum->room->OnPlayerOffline(hum);
|
||||||
}
|
}
|
||||||
#if MYDEBUG
|
#if MYDEBUG
|
||||||
a8::XPrintf("remove socket1 %d\n", {hdr.socket_handle});
|
a8::XPrintf("remove socket1 %d\n", {hdr->socket_handle});
|
||||||
#endif
|
#endif
|
||||||
if (MatchMgr::Instance()->GetMatchInfo(hdr.socket_handle)) {
|
if (MatchMgr::Instance()->GetMatchInfo(hdr->socket_handle)) {
|
||||||
#if MYDEBUG
|
#if MYDEBUG
|
||||||
a8::XPrintf("remove socket2 %d\n", {hdr.socket_handle});
|
a8::XPrintf("remove socket2 %d\n", {hdr->socket_handle});
|
||||||
#endif
|
#endif
|
||||||
MatchMgr::Instance()->RemoveSocket(hdr.socket_handle);
|
MatchMgr::Instance()->RemoveSocket(hdr->socket_handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMgr::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
void PlayerMgr::_SS_Ping(f8::MsgHdr* hdr, const ss::SS_Ping& msg)
|
||||||
{
|
{
|
||||||
ss::SS_Pong respmsg;
|
ss::SS_Pong respmsg;
|
||||||
GGListener::Instance()->SendToClient(hdr.socket_handle, 0, respmsg);
|
GGListener::Instance()->SendToClient(hdr->socket_handle, 0, respmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Team::FillSMGameOver(cs::SMGameOver& msg)
|
void Team::FillSMGameOver(cs::SMGameOver& msg)
|
||||||
|
@ -857,14 +857,14 @@ void Player::ProcSkillList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
void Player::_CMReconnect(f8::MsgHdr* hdr, const cs::CMReconnect& msg)
|
||||||
{
|
{
|
||||||
int old_socket_handle = socket_handle;
|
int old_socket_handle = socket_handle;
|
||||||
if (socket_handle != 0) {
|
if (socket_handle != 0) {
|
||||||
GGListener::Instance()->ForceCloseChildSocket(socket_handle);
|
GGListener::Instance()->ForceCloseChildSocket(socket_handle);
|
||||||
PlayerMgr::Instance()->RemovePlayerBySocket(socket_handle);
|
PlayerMgr::Instance()->RemovePlayerBySocket(socket_handle);
|
||||||
}
|
}
|
||||||
socket_handle = hdr.socket_handle;
|
socket_handle = hdr->socket_handle;
|
||||||
TraverseAllLayerHumanList
|
TraverseAllLayerHumanList
|
||||||
(
|
(
|
||||||
[this] (Human* hum, bool& stop)
|
[this] (Human* hum, bool& stop)
|
||||||
@ -883,7 +883,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
|||||||
("战斗服重连成功 %s %d %d",
|
("战斗服重连成功 %s %d %d",
|
||||||
{
|
{
|
||||||
account_id,
|
account_id,
|
||||||
hdr.socket_handle,
|
hdr->socket_handle,
|
||||||
old_socket_handle
|
old_socket_handle
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
@ -913,7 +913,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
|
||||||
{
|
{
|
||||||
#ifdef MYDEBUG1
|
#ifdef MYDEBUG1
|
||||||
if (msg.shot_start() || msg.shot_hold()) {
|
if (msg.shot_start() || msg.shot_hold()) {
|
||||||
@ -1208,7 +1208,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMImmediateMsg(f8::MsgHdr& hdr, const cs::CMImmediateMsg& msg)
|
void Player::_CMImmediateMsg(f8::MsgHdr* hdr, const cs::CMImmediateMsg& msg)
|
||||||
{
|
{
|
||||||
if (msg.stop_move()) {
|
if (msg.stop_move()) {
|
||||||
moving = false;
|
moving = false;
|
||||||
@ -1245,12 +1245,12 @@ void Player::UpdateUseScope()
|
|||||||
use_scope_idx = 0;
|
use_scope_idx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMEmote(f8::MsgHdr& hdr, const cs::CMEmote& msg)
|
void Player::_CMEmote(f8::MsgHdr* hdr, const cs::CMEmote& msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg)
|
void Player::_CMVoice(f8::MsgHdr* hdr, const cs::CMVoice& msg)
|
||||||
{
|
{
|
||||||
cs::SMVoiceNotify notifymsg;
|
cs::SMVoiceNotify notifymsg;
|
||||||
notifymsg.set_account_id(account_id);
|
notifymsg.set_account_id(account_id);
|
||||||
@ -1262,7 +1262,7 @@ void Player::_CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg)
|
|||||||
room->TraversePlayerList(send_func);
|
room->TraversePlayerList(send_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMGameOver(f8::MsgHdr& hdr, const cs::CMGameOver& msg)
|
void Player::_CMGameOver(f8::MsgHdr* hdr, const cs::CMGameOver& msg)
|
||||||
{
|
{
|
||||||
if (room->GetGasData().GetGasMode() == GasInactive) {
|
if (room->GetGasData().GetGasMode() == GasInactive) {
|
||||||
stats->is_run_away = true;
|
stats->is_run_away = true;
|
||||||
@ -1283,14 +1283,14 @@ void Player::_CMGameOver(f8::MsgHdr& hdr, const cs::CMGameOver& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMWatchWar(f8::MsgHdr& hdr, const cs::CMWatchWar& msg)
|
void Player::_CMWatchWar(f8::MsgHdr* hdr, const cs::CMWatchWar& msg)
|
||||||
{
|
{
|
||||||
if (!room->IsMobaModeRoom()) {
|
if (!room->IsMobaModeRoom()) {
|
||||||
AsyncRequestWatchWar(true);
|
AsyncRequestWatchWar(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg)
|
void Player::_CMLeave(f8::MsgHdr* hdr, const cs::CMLeave& msg)
|
||||||
{
|
{
|
||||||
if (room->GetGasData().GetGasMode() == GasInactive) {
|
if (room->GetGasData().GetGasMode() == GasInactive) {
|
||||||
stats->is_run_away = true;
|
stats->is_run_away = true;
|
||||||
@ -1307,7 +1307,7 @@ void Player::_CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg)
|
|||||||
SendNotifyMsg(respmsg);
|
SendNotifyMsg(respmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg)
|
void Player::_CMRevive(f8::MsgHdr* hdr, const cs::CMRevive& msg)
|
||||||
{
|
{
|
||||||
Human* hum = room->GetHumanByUniId(msg.target_uniid());
|
Human* hum = room->GetHumanByUniId(msg.target_uniid());
|
||||||
if (hum && !hum->real_dead && hum->dead &&
|
if (hum && !hum->real_dead && hum->dead &&
|
||||||
@ -1373,12 +1373,12 @@ void Player::_CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMCancelRevive(f8::MsgHdr& hdr, const cs::CMCancelRevive& msg)
|
void Player::_CMCancelRevive(f8::MsgHdr* hdr, const cs::CMCancelRevive& msg)
|
||||||
{
|
{
|
||||||
CancelRevive();
|
CancelRevive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg& msg)
|
void Player::_CMRequestBulletDmg(f8::MsgHdr* hdr, const cs::CMRequestBulletDmg& msg)
|
||||||
{
|
{
|
||||||
auto itr = room->report_bullet_hash.find(msg.bullet_uniid());
|
auto itr = room->report_bullet_hash.find(msg.bullet_uniid());
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
@ -1411,17 +1411,17 @@ void Player::_CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg&
|
|||||||
room->report_bullet_hash.erase(msg.bullet_uniid());
|
room->report_bullet_hash.erase(msg.bullet_uniid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMRequestThrowDmg(f8::MsgHdr& hdr, const cs::CMRequestThrowDmg& msg)
|
void Player::_CMRequestThrowDmg(f8::MsgHdr* hdr, const cs::CMRequestThrowDmg& msg)
|
||||||
{
|
{
|
||||||
ProcThrowDmg(msg.throw_uniid());
|
ProcThrowDmg(msg.throw_uniid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMStowShield(f8::MsgHdr& hdr, const cs::CMStowShield& msg)
|
void Player::_CMStowShield(f8::MsgHdr* hdr, const cs::CMStowShield& msg)
|
||||||
{
|
{
|
||||||
RemoveBuffByEffectId(kBET_HoldShield);
|
RemoveBuffByEffectId(kBET_HoldShield);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMTeamMarkTargetPos(f8::MsgHdr& hdr, const cs::CMTeamMarkTargetPos& msg)
|
void Player::_CMTeamMarkTargetPos(f8::MsgHdr* hdr, const cs::CMTeamMarkTargetPos& msg)
|
||||||
{
|
{
|
||||||
if (GetTeam()) {
|
if (GetTeam()) {
|
||||||
if (msg.has_pos()) {
|
if (msg.has_pos()) {
|
||||||
@ -1746,12 +1746,12 @@ void Player::UpdateThrowBomb()
|
|||||||
throw_bomb.reset();
|
throw_bomb.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMSetRevivePosition(f8::MsgHdr& hdr, const cs::CMSetRevivePosition& msg)
|
void Player::_CMSetRevivePosition(f8::MsgHdr* hdr, const cs::CMSetRevivePosition& msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_CMGetSettlementTeamList(f8::MsgHdr& hdr, const cs::CMGetSettlementTeamList& msg)
|
void Player::_CMGetSettlementTeamList(f8::MsgHdr* hdr, const cs::CMGetSettlementTeamList& msg)
|
||||||
{
|
{
|
||||||
cs::SMGetSettlementTeamList rspmsg;
|
cs::SMGetSettlementTeamList rspmsg;
|
||||||
std::vector<Team*> sorted_teams;
|
std::vector<Team*> sorted_teams;
|
||||||
|
@ -121,23 +121,23 @@ class Player : public Human
|
|||||||
void ProcSkillList();
|
void ProcSkillList();
|
||||||
void PushJoinRoomMsg();
|
void PushJoinRoomMsg();
|
||||||
|
|
||||||
void _CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg);
|
void _CMReconnect(f8::MsgHdr* hdr, const cs::CMReconnect& msg);
|
||||||
void _CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg);
|
void _CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg);
|
||||||
void _CMImmediateMsg(f8::MsgHdr& hdr, const cs::CMImmediateMsg& msg);
|
void _CMImmediateMsg(f8::MsgHdr* hdr, const cs::CMImmediateMsg& msg);
|
||||||
void _CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg);
|
void _CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg);
|
||||||
void _CMEmote(f8::MsgHdr& hdr, const cs::CMEmote& msg);
|
void _CMEmote(f8::MsgHdr* hdr, const cs::CMEmote& msg);
|
||||||
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
|
void _CMVoice(f8::MsgHdr* hdr, const cs::CMVoice& msg);
|
||||||
void _CMGameOver(f8::MsgHdr& hdr, const cs::CMGameOver& msg);
|
void _CMGameOver(f8::MsgHdr* hdr, const cs::CMGameOver& msg);
|
||||||
void _CMWatchWar(f8::MsgHdr& hdr, const cs::CMWatchWar& msg);
|
void _CMWatchWar(f8::MsgHdr* hdr, const cs::CMWatchWar& msg);
|
||||||
void _CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg);
|
void _CMLeave(f8::MsgHdr* hdr, const cs::CMLeave& msg);
|
||||||
void _CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg);
|
void _CMRevive(f8::MsgHdr* hdr, const cs::CMRevive& msg);
|
||||||
void _CMCancelRevive(f8::MsgHdr& hdr, const cs::CMCancelRevive& msg);
|
void _CMCancelRevive(f8::MsgHdr* hdr, const cs::CMCancelRevive& msg);
|
||||||
void _CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg& msg);
|
void _CMRequestBulletDmg(f8::MsgHdr* hdr, const cs::CMRequestBulletDmg& msg);
|
||||||
void _CMRequestThrowDmg(f8::MsgHdr& hdr, const cs::CMRequestThrowDmg& msg);
|
void _CMRequestThrowDmg(f8::MsgHdr* hdr, const cs::CMRequestThrowDmg& msg);
|
||||||
void _CMStowShield(f8::MsgHdr& hdr, const cs::CMStowShield& msg);
|
void _CMStowShield(f8::MsgHdr* hdr, const cs::CMStowShield& msg);
|
||||||
void _CMTeamMarkTargetPos(f8::MsgHdr& hdr, const cs::CMTeamMarkTargetPos& msg);
|
void _CMTeamMarkTargetPos(f8::MsgHdr* hdr, const cs::CMTeamMarkTargetPos& msg);
|
||||||
void _CMSetRevivePosition(f8::MsgHdr& hdr, const cs::CMSetRevivePosition& msg);
|
void _CMSetRevivePosition(f8::MsgHdr* hdr, const cs::CMSetRevivePosition& msg);
|
||||||
void _CMGetSettlementTeamList(f8::MsgHdr& hdr, const cs::CMGetSettlementTeamList& msg);
|
void _CMGetSettlementTeamList(f8::MsgHdr* hdr, const cs::CMGetSettlementTeamList& msg);
|
||||||
virtual void SetAttackDir(const glm::vec3& attack_dir) override;
|
virtual void SetAttackDir(const glm::vec3& attack_dir) override;
|
||||||
void AsyncRequestWatchWar(bool send_rsp_msg);
|
void AsyncRequestWatchWar(bool send_rsp_msg);
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
|
|||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
|
||||||
void _SS_WSP_SocketDisconnect(f8::MsgHdr& hdr, const ss::SS_WSP_SocketDisconnect& msg);
|
void _SS_WSP_SocketDisconnect(f8::MsgHdr* hdr, const ss::SS_WSP_SocketDisconnect& msg);
|
||||||
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
|
void _SS_Ping(f8::MsgHdr* hdr, const ss::SS_Ping& msg);
|
||||||
|
|
||||||
int OnlineNum();
|
int OnlineNum();
|
||||||
Player* GetPlayerBySocket(int socket);
|
Player* GetPlayerBySocket(int socket);
|
||||||
|
@ -108,10 +108,10 @@ void RoomMgr::Update(int delta_time)
|
|||||||
PerfMonitor::Instance()->real_alive_count = real_alive_count;
|
PerfMonitor::Instance()->real_alive_count = real_alive_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
if (IsLimitJoin()) {
|
if (IsLimitJoin()) {
|
||||||
JoinErrorHandle(msg, 2, hdr.socket_handle);
|
JoinErrorHandle(msg, 2, hdr->socket_handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
}
|
}
|
||||||
const mt::Map* map_meta = mt::Map::GetById(msg.mapid());
|
const mt::Map* map_meta = mt::Map::GetById(msg.mapid());
|
||||||
if (!map_meta || !map_meta->IsOpen()) {
|
if (!map_meta || !map_meta->IsOpen()) {
|
||||||
JoinErrorHandle(msg, 3, hdr.socket_handle);
|
JoinErrorHandle(msg, 3, hdr->socket_handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!msg.custom_room_payload().empty()) {
|
if (!msg.custom_room_payload().empty()) {
|
||||||
@ -145,8 +145,8 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
std::shared_ptr<cs::CMJoin> join_msg = std::make_shared<cs::CMJoin>();
|
std::shared_ptr<cs::CMJoin> join_msg = std::make_shared<cs::CMJoin>();
|
||||||
*join_msg = msg;
|
*join_msg = msg;
|
||||||
std::vector<std::shared_ptr<cs::CMJoin>> join_msgs{join_msg};
|
std::vector<std::shared_ptr<cs::CMJoin>> join_msgs{join_msg};
|
||||||
auto ip_saddr = hdr.ip_saddr;
|
auto ip_saddr = hdr->ip_saddr;
|
||||||
auto socket_handle = hdr.socket_handle;
|
auto socket_handle = hdr->socket_handle;
|
||||||
auto cb =
|
auto cb =
|
||||||
[ip_saddr, socket_handle, join_msg]
|
[ip_saddr, socket_handle, join_msg]
|
||||||
(std::vector<std::shared_ptr<BattleDataContext>>& results)
|
(std::vector<std::shared_ptr<BattleDataContext>>& results)
|
||||||
@ -218,7 +218,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
SendGetBattleData(0, join_msgs, cb);
|
SendGetBattleData(0, join_msgs, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
void RoomMgr::_CMReconnect(f8::MsgHdr* hdr, const cs::CMReconnect& msg)
|
||||||
{
|
{
|
||||||
auto send_reconnect_failed =
|
auto send_reconnect_failed =
|
||||||
[] (int socket_handle, int errcode, const std::string& errmsg)
|
[] (int socket_handle, int errcode, const std::string& errmsg)
|
||||||
@ -241,7 +241,7 @@ void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
|||||||
|
|
||||||
auto room = GetRoomByUuid(a8::XValue(msg.room_uuid()));
|
auto room = GetRoomByUuid(a8::XValue(msg.room_uuid()));
|
||||||
if (!room) {
|
if (!room) {
|
||||||
send_reconnect_failed(hdr.socket_handle, 1,
|
send_reconnect_failed(hdr->socket_handle, 1,
|
||||||
TEXT("battle_server_reconnect_failreason_room_destoryed", "房间已销毁"));
|
TEXT("battle_server_reconnect_failreason_room_destoryed", "房间已销毁"));
|
||||||
f8::UdpLog::Instance()->Debug
|
f8::UdpLog::Instance()->Debug
|
||||||
("房间已销毁 %s",
|
("房间已销毁 %s",
|
||||||
@ -252,24 +252,24 @@ void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
|||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if (room->GetRoomMode() != kPvpMode) {
|
if (room->GetRoomMode() != kPvpMode) {
|
||||||
send_reconnect_failed(hdr.socket_handle, 1,
|
send_reconnect_failed(hdr->socket_handle, 1,
|
||||||
TEXT("battle_server_reconnect_failreason_only_chiji", "只有吃鸡模式支持重连"));
|
TEXT("battle_server_reconnect_failreason_only_chiji", "只有吃鸡模式支持重连"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Player* hum = room->GetPlayerByAccountId(msg.account_id());
|
Player* hum = room->GetPlayerByAccountId(msg.account_id());
|
||||||
if (!hum) {
|
if (!hum) {
|
||||||
send_reconnect_failed(hdr.socket_handle, 1,
|
send_reconnect_failed(hdr->socket_handle, 1,
|
||||||
TEXT("battle_server_reconnect_failreason_notfound_accountid", "accountid未在房间列表"));
|
TEXT("battle_server_reconnect_failreason_notfound_accountid", "accountid未在房间列表"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hum->_CMReconnect(hdr, msg);
|
hum->_CMReconnect(hdr, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomMgr::_CMPing(f8::MsgHdr& hdr, const cs::CMPing& msg)
|
void RoomMgr::_CMPing(f8::MsgHdr* hdr, const cs::CMPing& msg)
|
||||||
{
|
{
|
||||||
cs::SMPing respmsg;
|
cs::SMPing respmsg;
|
||||||
GGListener::Instance()->SendToClient(hdr.socket_handle, 0, respmsg);
|
GGListener::Instance()->SendToClient(hdr->socket_handle, 0, respmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RoomMgr::RoomNum()
|
int RoomMgr::RoomNum()
|
||||||
@ -920,15 +920,15 @@ std::shared_ptr<CustomBattle> RoomMgr::GetHisCustomRoom(const std::string& room_
|
|||||||
return itr != his_custom_room_hash_.end() ? itr->second : nullptr;
|
return itr != his_custom_room_hash_.end() ? itr->second : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
void RoomMgr::_CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||||
{
|
{
|
||||||
if (msg.custom_room_payload().empty()) {
|
if (msg.custom_room_payload().empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::shared_ptr<cs::CMJoin> join_msg = std::make_shared<cs::CMJoin>();
|
std::shared_ptr<cs::CMJoin> join_msg = std::make_shared<cs::CMJoin>();
|
||||||
*join_msg = msg;
|
*join_msg = msg;
|
||||||
auto ip_saddr = hdr.ip_saddr;
|
auto ip_saddr = hdr->ip_saddr;
|
||||||
auto socket_handle = hdr.socket_handle;
|
auto socket_handle = hdr->socket_handle;
|
||||||
auto cb =
|
auto cb =
|
||||||
[join_msg, ip_saddr, socket_handle]
|
[join_msg, ip_saddr, socket_handle]
|
||||||
(int errcode, const std::string errmsg, std::shared_ptr<CustomBattle> p)
|
(int errcode, const std::string errmsg, std::shared_ptr<CustomBattle> p)
|
||||||
|
@ -72,9 +72,9 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
void UnInit();
|
void UnInit();
|
||||||
void Update(int delta_time);
|
void Update(int delta_time);
|
||||||
|
|
||||||
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void _CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
void _CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg);
|
void _CMReconnect(f8::MsgHdr* hdr, const cs::CMReconnect& msg);
|
||||||
void _CMPing(f8::MsgHdr& hdr, const cs::CMPing& msg);
|
void _CMPing(f8::MsgHdr* hdr, const cs::CMPing& msg);
|
||||||
void ActiveRoom(const std::string& room_uuid);
|
void ActiveRoom(const std::string& room_uuid);
|
||||||
int RoomNum();
|
int RoomNum();
|
||||||
int OverRoomNum();
|
int OverRoomNum();
|
||||||
@ -119,7 +119,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
void AdjustCMJoin(cs::CMJoin* msg);
|
void AdjustCMJoin(cs::CMJoin* msg);
|
||||||
std::shared_ptr<CustomBattle> GetCustomRoom(const std::string& room_uuid);
|
std::shared_ptr<CustomBattle> GetCustomRoom(const std::string& room_uuid);
|
||||||
std::shared_ptr<CustomBattle> GetHisCustomRoom(const std::string& room_uuid);
|
std::shared_ptr<CustomBattle> GetHisCustomRoom(const std::string& room_uuid);
|
||||||
void _CMJoinCustomBattle(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
void _CMJoinCustomBattle(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
||||||
void SendGetCustomBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
void SendGetCustomBattleData(std::shared_ptr<cs::CMJoin> join_msg,
|
||||||
std::function<void(int, const std::string, std::shared_ptr<CustomBattle>)> cb);
|
std::function<void(int, const std::string, std::shared_ptr<CustomBattle>)> cb);
|
||||||
|
|
||||||
|
2
third_party/f8
vendored
2
third_party/f8
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 7fb9c9083275fd35c2bb4456999673444dcfe986
|
Subproject commit 59d0a88a602354c0fccf1b72b43d2d78f2fe4d10
|
Loading…
x
Reference in New Issue
Block a user