From 754d7515d7db535bb949f1c33ecabba566bf4f30 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 19 Mar 2024 16:39:33 +0800 Subject: [PATCH] 1 --- server/matchserver/team/matchmgr.go | 12 +++++++++--- server/matchserver/team/team.go | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/server/matchserver/team/matchmgr.go b/server/matchserver/team/matchmgr.go index c69a3f79..69f53d09 100644 --- a/server/matchserver/team/matchmgr.go +++ b/server/matchserver/team/matchmgr.go @@ -28,7 +28,7 @@ func (this *matchMgr) Init() { func (this *matchMgr) UnInit() { } -func (this *matchMgr) addMatchingTeam(team *team) { +func (this *matchMgr) addMatch(team *team) { if this.getMatchingInfoByUuid(team.GetTeamUuid()) != nil { panic("111111") return @@ -41,11 +41,17 @@ func (this *matchMgr) addMatchingTeam(team *team) { this.mustBeZn(team.GetZnKey()).AddTail(&m.entry) } -func (this *matchMgr) cancelMatching(team *team) { +func (this *matchMgr) cancelMatch(team *team) bool { m := this.getMatchingInfoByUuid(team.GetTeamUuid()) if m != nil { - + if m.matchOk != nil { + panic("cancelMatching error") + return false + } + m.entry.DelInit() + delete(this.teamUuidHash, team.GetTeamUuid()) } + return false } func (this *matchMgr) getMatchingInfoByUuid(teamUuid string) *matchingInfo { diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index 5830151d..3877d6ec 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -139,7 +139,7 @@ func (this *team) StartGame() { if !this.IsLock() && this.CanStartGame(this.owner) { if this.IsMobaMode() { this.state = constant.TEAM_STATE_MATCHING - _matchMgr.addMatchingTeam(this) + _matchMgr.addMatch(this) this.SendStateNotify() } else { this.state = constant.TEAM_STATE_STARTED