45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <a8/singleton.h>
|
|
|
|
#include <f8/protoutils.h>
|
|
|
|
namespace cs
|
|
{
|
|
class CMJoin;
|
|
}
|
|
|
|
class MatchTeamNew;
|
|
class TeamGroup;
|
|
class MatchPool : public a8::Singleton<MatchPool>
|
|
{
|
|
private:
|
|
MatchPool() {};
|
|
friend class a8::Singleton<MatchPool>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
|
|
void _CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg);
|
|
|
|
private:
|
|
|
|
void TraverseTeam(std::function<void (std::shared_ptr<MatchTeamNew>&, bool&)> func);
|
|
|
|
bool NeedMatch(const cs::CMJoin& msg);
|
|
std::shared_ptr<MatchTeamNew> GetTeam(const std::string& team_uuid);
|
|
void RemoveTeam(const std::string& team_uuid);
|
|
void RemoveSocket(int socket_handle);
|
|
void Update();
|
|
|
|
private:
|
|
f8::Attacher timer_attacher_;
|
|
std::map<std::string, std::shared_ptr<MatchTeamNew>> team_hash_;
|
|
std::map<int, std::tuple<std::string, std::shared_ptr<MatchTeamNew>>> socket_hash_;
|
|
|
|
std::map<long long, std::shared_ptr<TeamGroup>> group_hash_;
|
|
std::map<long long, std::shared_ptr<TeamGroup>> matching_list_;
|
|
std::map<long long, std::shared_ptr<TeamGroup>> matchok_list_;
|
|
};
|