This commit is contained in:
aozhiwei 2021-09-27 15:22:03 +00:00
parent 9054d3626d
commit ca77e15acc
4 changed files with 28 additions and 1 deletions

View File

@ -109,3 +109,13 @@ std::tuple<std::string, MatchTeam*>* MatchMgr::GetMatchInfo(int socket_handle)
auto itr = socket_hash_.find(socket_handle);
return itr != socket_hash_.end() ? &itr->second : nullptr;
}
void MatchMgr::RemoveTeam(const std::string& team_uuid)
{
}
void MatchMgr::RemoveSocket(int socket_handle)
{
}

View File

@ -32,6 +32,8 @@ public:
bool NeedMatch(const cs::CMJoin& msg);
MatchTeam* GetTeam(const std::string& team_uuid);
std::tuple<std::string, MatchTeam*>* GetMatchInfo(int socket_handle);
void RemoveTeam(const std::string& team_uuid);
void RemoveSocket(int socket_handle);
private:
std::map<std::string, MatchTeam*> team_hash_;

View File

@ -281,7 +281,8 @@ std::string MatchTeam::GetTeamUUid()
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()
@ -299,3 +300,16 @@ std::shared_ptr<RawTeamMember> MatchTeam::GetMemberBySocket(int socket_handle)
}
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());
}

View File

@ -47,6 +47,7 @@ class MatchTeam
bool IsSlaveTeam() { return master_team_ != this; };
int GetPhaseLeftTime();
std::shared_ptr<RawTeamMember> GetMemberBySocket(int socket_handle);
void StartGame();
private:
long long phase_start_tick_ = 0;