65 lines
1.4 KiB
C++
65 lines
1.4 KiB
C++
#include "precompile.h"
|
|
|
|
#include "mobabattle.h"
|
|
|
|
void MobaTeam::TraverseMember(std::function<bool (std::shared_ptr<MobaMember>)> cb)
|
|
{
|
|
|
|
}
|
|
|
|
bool MobaBattle::CanAdd(const std::string& account_id, const std::string& session_id)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
std::shared_ptr<MobaTeam> MobaBattle::GetTeamByAccountId(const std::string& account_id)
|
|
{
|
|
auto itr = account_hash_.find(account_id);
|
|
return itr != account_hash_.end() ? itr->second : nullptr;
|
|
}
|
|
|
|
std::shared_ptr<MobaMember> MobaBattle::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<MobaTeam> MobaBattle::GetTeamByTeamUuid(const std::string& team_uuid)
|
|
{
|
|
auto itr = uuid_hash_.find(team_uuid);
|
|
return itr != uuid_hash_.end() ? itr->second : nullptr;
|
|
}
|
|
|
|
bool MobaBattle::AllIsJoined()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
int MobaBattle::GetMemberNum()
|
|
{
|
|
return member_id_hash_.size();
|
|
}
|
|
|
|
int MobaBattle::GetTeamNum()
|
|
{
|
|
return uuid_hash_.size();
|
|
}
|
|
|
|
void MobaBattle::TraverseMemberList(std::function<bool (MobaMember*)> func)
|
|
{
|
|
for (auto& pair : member_id_hash_) {
|
|
if (!func(pair.second.get())) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void MobaBattle::TraverseTeam(std::function<bool (std::shared_ptr<MobaTeam>)> cb)
|
|
{
|
|
for (auto& pair : uuid_hash_) {
|
|
if (!cb(pair.second)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|