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 "cs_proto.pb.h"
#include "matchpool.h" #include "matchpool.h"
#include "GGListener.h" #include "GGListener.h"
#include "matchteam.h" #include "matchteamnew.h"
void MatchPool::Init() 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); auto itr = team_hash_.find(team_uuid);
return itr != team_hash_.end() ? itr->second : nullptr; 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) { if (!func) {
return; 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); auto itr = socket_hash_.find(socket_handle);
return itr != socket_hash_.end() ? &itr->second : nullptr; return itr != socket_hash_.end() ? &itr->second : nullptr;

View File

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