1
This commit is contained in:
parent
41c3bd0ba9
commit
facdefe713
@ -80,36 +80,18 @@ void CustomBattle::ParseResult(a8::XObject& obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
auto ob_team_ = std::make_shared<CustomTeam>();
|
||||||
|
ob_team_->team_uuid_ = "";
|
||||||
|
ob_team_->is_view_ = true;
|
||||||
auto ob_list = obj.At("ob_list");
|
auto ob_list = obj.At("ob_list");
|
||||||
for (int i = 0;i < ob_list->Size(); ++i) {
|
for (int i = 0; i < ob_list->Size(); ++i) {
|
||||||
auto team_obj = ob_list->At(i);
|
auto member_obj = ob_list->At(i);
|
||||||
if (!team_obj || !team_obj->IsObject()) {
|
|
||||||
parse_ok_ = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::string team_uuid = team_obj->Get("team_uuid").GetString();
|
|
||||||
int is_view = team_obj->Get("is_view").GetInt();
|
|
||||||
auto member_list = team_obj->At("members");
|
|
||||||
if (!member_list ||
|
|
||||||
!member_list->IsArray()) {
|
|
||||||
parse_ok_ = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto team = GetTeamByTeamUuid(team_uuid);
|
|
||||||
if (!team) {
|
|
||||||
team = std::make_shared<CustomTeam>();
|
|
||||||
team->team_uuid_ = team_uuid;
|
|
||||||
team->is_view_ = is_view ? true : false;
|
|
||||||
uuid_hash_[team->team_uuid_] = team;
|
|
||||||
}
|
|
||||||
for (int ii = 0; ii < member_list->Size(); ++ii) {
|
|
||||||
auto member_obj = member_list->At(ii);
|
|
||||||
if (!member_obj || !member_obj->IsObject()) {
|
if (!member_obj || !member_obj->IsObject()) {
|
||||||
parse_ok_ = false;
|
parse_ok_ = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto member = std::make_shared<CustomMember>();
|
auto member = std::make_shared<CustomMember>();
|
||||||
member->team_ = team.get();
|
member->team_ = ob_team_.get();
|
||||||
member->account_id_ = member_obj->Get("account_id").GetString();
|
member->account_id_ = member_obj->Get("account_id").GetString();
|
||||||
member->session_id_ = member_obj->Get("session_id").GetString();
|
member->session_id_ = member_obj->Get("session_id").GetString();
|
||||||
member->name_ = member_obj->Get("name").GetString();
|
member->name_ = member_obj->Get("name").GetString();
|
||||||
@ -120,10 +102,8 @@ void CustomBattle::ParseResult(a8::XObject& obj)
|
|||||||
parse_ok_ = false;
|
parse_ok_ = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
member_id_hash_[member->account_id_] = member;
|
account_hash_[member->account_id_] = ob_team_;
|
||||||
team->member_hash_[member->account_id_] = member;
|
ob_id_hash_[member->account_id_] = ob_id_hash_;
|
||||||
account_hash_[member->account_id_] = team;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class CustomBattle
|
|||||||
std::string sign_;
|
std::string sign_;
|
||||||
std::shared_ptr<a8::XObject> raw_data_;
|
std::shared_ptr<a8::XObject> raw_data_;
|
||||||
std::map<std::string, std::shared_ptr<CustomTeam>> uuid_hash_;
|
std::map<std::string, std::shared_ptr<CustomTeam>> uuid_hash_;
|
||||||
std::map<std::string, std::shared_ptr<CustomTeam>> ob_team_hash_;
|
std::shared_ptr<CustomTeam> ob_team_;
|
||||||
std::map<std::string, std::shared_ptr<CustomTeam>> account_hash_;
|
std::map<std::string, std::shared_ptr<CustomTeam>> account_hash_;
|
||||||
std::map<std::string, std::shared_ptr<CustomMember>> member_id_hash_;
|
std::map<std::string, std::shared_ptr<CustomMember>> member_id_hash_;
|
||||||
std::map<std::string, std::shared_ptr<CustomMember>> ob_id_hash_;
|
std::map<std::string, std::shared_ptr<CustomMember>> ob_id_hash_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user