1
This commit is contained in:
parent
ac92dfecf2
commit
82819a0c98
@ -67,6 +67,7 @@ void CustomBattle::ParseResult(a8::XObject& obj)
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
member_id_hash_[member->account_id_] = member;
|
||||
team->member_hash_[member->account_id_] = member;
|
||||
account_hash_[member->account_id_] = team;
|
||||
}
|
||||
@ -82,6 +83,12 @@ bool CustomBattle::CanAdd(const std::string& account_id, const std::string& sess
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<CustomMember> CustomBattle::GetMemberByAccountId(const std::string& account_id)
|
||||
{
|
||||
auto itr = member_id_hash_.find(account_id);
|
||||
return itr != member_id_hash_.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CustomTeam> CustomBattle::GetTeamByAccountId(const std::string& account_id)
|
||||
{
|
||||
auto itr = account_hash_.find(account_id);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
class Room;
|
||||
class CustomTeam;
|
||||
class CustomMember;
|
||||
class CustomBattle
|
||||
{
|
||||
public:
|
||||
@ -21,6 +22,7 @@ class CustomBattle
|
||||
void ParseResult(a8::XObject& obj);
|
||||
bool CanAdd(const std::string& account_id, const std::string& session_id);
|
||||
std::shared_ptr<CustomTeam> GetTeamByAccountId(const std::string& account_id);
|
||||
std::shared_ptr<CustomMember> GetMemberByAccountId(const std::string& account_id);
|
||||
std::shared_ptr<CustomTeam> GetTeamByTeamUuid(const std::string& team_uuid);
|
||||
|
||||
private:
|
||||
@ -35,4 +37,5 @@ class CustomBattle
|
||||
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>> account_hash_;
|
||||
std::map<std::string, std::shared_ptr<CustomMember>> member_id_hash_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user