This commit is contained in:
aozhiwei 2022-10-24 10:19:33 +08:00
parent cdc56bcf37
commit 2a9b4bab79
4 changed files with 27 additions and 12 deletions

View File

@ -5,7 +5,7 @@
#include "cs_proto.pb.h"
#include "matchpool.h"
#include "GGListener.h"
#include "matchteam.h"
#include "matchteamnew.h"
void MatchPool::Init()
{
@ -20,13 +20,13 @@ void MatchPool::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
{
}
MatchTeam* MatchPool::GetTeam(const std::string& team_uuid)
MatchTeamNew* MatchPool::GetTeam(const std::string& team_uuid)
{
auto itr = team_hash_.find(team_uuid);
return itr != team_hash_.end() ? itr->second : nullptr;
}
void MatchPool::TraverseTeam(std::function<void (MatchTeam*, bool&)> func)
void MatchPool::TraverseTeam(std::function<void (MatchTeamNew*, bool&)> func)
{
if (!func) {
return;
@ -42,7 +42,7 @@ void MatchPool::TraverseTeam(std::function<void (MatchTeam*, bool&)> func)
}
}
std::tuple<std::string, MatchTeam*>* MatchPool::GetMatchInfo(int socket_handle)
std::tuple<std::string, MatchTeamNew*>* MatchPool::GetMatchInfo(int socket_handle)
{
auto itr = socket_hash_.find(socket_handle);
return itr != socket_hash_.end() ? &itr->second : nullptr;

View File

@ -5,7 +5,7 @@ namespace cs
class CMJoin;
}
class MatchTeam;
class MatchTeamNew;
class MatchPool : public a8::Singleton<MatchPool>
{
private:
@ -20,20 +20,20 @@ public:
private:
void TraverseTeam(std::function<void (MatchTeam*, bool&)> func);
void TraverseTeam(std::function<void (MatchTeamNew*, bool&)> func);
bool NeedMatch(const cs::CMJoin& msg);
MatchTeam* GetTeam(const std::string& team_uuid);
std::tuple<std::string, MatchTeam*>* GetMatchInfo(int socket_handle);
MatchTeamNew* GetTeam(const std::string& team_uuid);
std::tuple<std::string, MatchTeamNew*>* GetMatchInfo(int socket_handle);
void RemoveTeam(const std::string& team_uuid);
void RemoveSocket(int socket_handle);
private:
a8::TimerAttacher timer_attacher_;
std::map<std::string, MatchTeam*> team_hash_;
std::map<int, std::tuple<std::string, MatchTeam*>> socket_hash_;
std::map<std::string, MatchTeamNew*> team_hash_;
std::map<int, std::tuple<std::string, MatchTeamNew*>> socket_hash_;
std::vector<MatchTeam*> matching_list_;
std::vector<MatchTeam*> matchok_list_;
std::vector<MatchTeamNew*> matching_list_;
std::vector<MatchTeamNew*> matchok_list_;
};

View File

@ -0,0 +1,3 @@
#include "precompile.h"
#include "matchteamnew.h"

View File

@ -0,0 +1,12 @@
#pragma once
#include "cs_proto.pb.h"
#include "battledatacontext.h"
#include "matchteam.h"
class MatchTeamNew
{
};