1
This commit is contained in:
parent
9054d3626d
commit
ca77e15acc
@ -109,3 +109,13 @@ std::tuple<std::string, MatchTeam*>* MatchMgr::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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MatchMgr::RemoveTeam(const std::string& team_uuid)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchMgr::RemoveSocket(int socket_handle)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
bool NeedMatch(const cs::CMJoin& msg);
|
bool NeedMatch(const cs::CMJoin& msg);
|
||||||
MatchTeam* GetTeam(const std::string& team_uuid);
|
MatchTeam* GetTeam(const std::string& team_uuid);
|
||||||
std::tuple<std::string, MatchTeam*>* GetMatchInfo(int socket_handle);
|
std::tuple<std::string, MatchTeam*>* GetMatchInfo(int socket_handle);
|
||||||
|
void RemoveTeam(const std::string& team_uuid);
|
||||||
|
void RemoveSocket(int socket_handle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, MatchTeam*> team_hash_;
|
std::map<std::string, MatchTeam*> team_hash_;
|
||||||
|
@ -281,7 +281,8 @@ std::string MatchTeam::GetTeamUUid()
|
|||||||
|
|
||||||
bool MatchTeam::IsShuaRobotTime()
|
bool MatchTeam::IsShuaRobotTime()
|
||||||
{
|
{
|
||||||
return phase_ == kMatchCombining && phase_left_time_ <= MetaMgr::Instance()->match_robot_time;
|
return phase_ == kMatchCombining &&
|
||||||
|
phase_left_time_ <= MetaMgr::Instance()->match_robot_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MatchTeam::GetPhaseLeftTime()
|
int MatchTeam::GetPhaseLeftTime()
|
||||||
@ -299,3 +300,16 @@ std::shared_ptr<RawTeamMember> MatchTeam::GetMemberBySocket(int socket_handle)
|
|||||||
}
|
}
|
||||||
return std::shared_ptr<RawTeamMember>();
|
return std::shared_ptr<RawTeamMember>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MatchTeam::StartGame()
|
||||||
|
{
|
||||||
|
for (auto& member : curr_member_hash_) {
|
||||||
|
if (member->socket_handle != 0) {
|
||||||
|
MatchMgr::Instance()->RemoveSocket(member->socket_handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto& pair : combined_team_hash_) {
|
||||||
|
MatchMgr::Instance()->RemoveTeam(pair.first);
|
||||||
|
}
|
||||||
|
MatchMgr::Instance()->RemoveTeam(GetTeamUUid());
|
||||||
|
}
|
||||||
|
@ -47,6 +47,7 @@ class MatchTeam
|
|||||||
bool IsSlaveTeam() { return master_team_ != this; };
|
bool IsSlaveTeam() { return master_team_ != this; };
|
||||||
int GetPhaseLeftTime();
|
int GetPhaseLeftTime();
|
||||||
std::shared_ptr<RawTeamMember> GetMemberBySocket(int socket_handle);
|
std::shared_ptr<RawTeamMember> GetMemberBySocket(int socket_handle);
|
||||||
|
void StartGame();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long long phase_start_tick_ = 0;
|
long long phase_start_tick_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user