1
This commit is contained in:
parent
a3ef9aa1e7
commit
e56ab67d92
@ -160,10 +160,10 @@ void MobaBattle::ParseResult(a8::XObject& obj)
|
||||
parse_ok_ = true;
|
||||
}
|
||||
|
||||
void MobaBattle::TraverseObList(std::function<bool (MobaMember*)> cb)
|
||||
void MobaBattle::TraverseObList(std::function<bool (std::shared_ptr<MobaMember>)> cb)
|
||||
{
|
||||
for (auto& pair : ob_id_hash_) {
|
||||
if (!cb(pair.second.get())) {
|
||||
if (!cb(pair.second)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class MobaBattle
|
||||
int GetMemberNum();
|
||||
int GetTeamNum();
|
||||
void TraverseMemberList(std::function<bool (MobaMember*)> func);
|
||||
void TraverseObList(std::function<bool (MobaMember*)> func);
|
||||
void TraverseObList(std::function<bool (std::shared_ptr<MobaMember>)> func);
|
||||
void TraverseTeam(std::function<bool (std::shared_ptr<MobaTeam>)> cb);
|
||||
|
||||
private:
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "mobabattle.h"
|
||||
#include "roommgr.h"
|
||||
#include "bornpoint.h"
|
||||
#include "roomob.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Buff.h"
|
||||
@ -2530,14 +2531,11 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
|
||||
side = 1;
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
{
|
||||
auto hum = GetPlayerByAccountId(msg->account_id());
|
||||
if (hum) {
|
||||
hum->ReJoin(ip_saddr, socket_handle, msg, p);
|
||||
} else {
|
||||
auto m = p->GetObByAccountId(msg->account_id());
|
||||
if (m) {
|
||||
p->TraverseObList
|
||||
(
|
||||
[ip_saddr, socket_handle, join_msg, p] (std::shared_ptr<MobaMember> m) mutable -> bool
|
||||
{
|
||||
Player* hum = p->GetRoom()->NewPlayer();
|
||||
//hum->ip_saddr = ip_saddr;
|
||||
//hum->socket_handle = socket_handle;
|
||||
@ -2579,6 +2577,8 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
|
||||
hum->GetNetData()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
|
||||
hum->hero_uniid = hero_uniid;
|
||||
}
|
||||
a8::SetBitFlag(hum->status, CS_IsOb);
|
||||
p->GetRoom()->GetRoomOb()->AddOb(hum);
|
||||
p->GetRoom()->AddPlayer(hum);
|
||||
hum->ProcSkillList();
|
||||
hum->SetHP(hum->GetNetData()->GetMaxHP());
|
||||
@ -2586,15 +2586,26 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
|
||||
PlayerMgr::Instance()->IncAccountNum(join_msg.account_id());
|
||||
RoomMgr::Instance()->OnJoinRoomOk(join_msg, hum);
|
||||
//new_team->AddMember(hum);
|
||||
hum->ReJoin(ip_saddr, socket_handle, msg, p);
|
||||
//hum->ReJoin(ip_saddr, socket_handle, msg, p);
|
||||
#ifdef MYDEBUG
|
||||
a8::XPrintf("moba init1 uniid:%d team_id:%d side:%d\n",
|
||||
a8::XPrintf("moba init11 uniid:%d team_id:%d side:%d\n",
|
||||
{
|
||||
hum->GetUniId(),
|
||||
hum->GetTeam()->GetTeamId(),
|
||||
hum->side
|
||||
});
|
||||
#endif
|
||||
return true;
|
||||
});
|
||||
}
|
||||
#if 1
|
||||
{
|
||||
auto hum = GetPlayerByAccountId(msg->account_id());
|
||||
if (hum) {
|
||||
hum->ReJoin(ip_saddr, socket_handle, msg, p);
|
||||
} else {
|
||||
auto m = p->GetObByAccountId(msg->account_id());
|
||||
if (m) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user