From dcb522f0a55fd5a03cf24e71af79bdaf99a8c374 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 12 Jul 2024 16:43:36 +0800 Subject: [PATCH] 1 --- bin/matchserver/config/config.json | 3 ++- server/matchserver/team/matchmgr.go | 37 +++++++++++++++++------------ server/matchserver/team/team.go | 3 +-- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/bin/matchserver/config/config.json b/bin/matchserver/config/config.json index dde66853..cfafc6c5 100644 --- a/bin/matchserver/config/config.json +++ b/bin/matchserver/config/config.json @@ -3,5 +3,6 @@ "friendapi_url": "http://127.0.0.1:8879", "auto_start_time": 3600, "game_start_notify_time": 20, - "delay_delete_time": 60 + "delay_delete_time": 60, + "match_real_player": 1 } diff --git a/server/matchserver/team/matchmgr.go b/server/matchserver/team/matchmgr.go index 9d76c0cc..04f9aebd 100644 --- a/server/matchserver/team/matchmgr.go +++ b/server/matchserver/team/matchmgr.go @@ -87,23 +87,30 @@ func (this *matchMgr) execMatch(m *matchingInfo) { this.oldExecMatch(m) return } - l := this.mustBeZn(m.team.GetZnKey()) - l.ForEach( - func (ele interface{}) bool { - if targetM, ok := ele.(*matchingInfo); ok { - if m != targetM && m.team.canMatch(targetM.team) { - m.matchOk = targetM - m.matchTick = q5.GetTickCount() + if m.team.HasOnlinePlayer() { + m.lastHasOnlinePlayerTick = q5.GetTickCount() + l := this.mustBeZn(m.team.GetZnKey()) + l.ForEach( + func (ele interface{}) bool { + if targetM, ok := ele.(*matchingInfo); ok { + if m != targetM && m.team.canMatch(targetM.team) { + m.matchOk = targetM + m.matchTick = q5.GetTickCount() - targetM.matchOk = m - targetM.matchTick = q5.GetTickCount() - return false + targetM.matchOk = m + targetM.matchTick = q5.GetTickCount() + return false + } } - } - return true - }) - if m.matchOk != nil { - this.onMatchOk(m) + return true + }) + if m.matchOk != nil { + this.onMatchOk(m) + } + } else if q5.GetTickCount() - m.lastHasOnlinePlayerTick > 1000 * 60 * 30 { + this.cancelMatch(m.team) + _teamMgr.removeTeam(m.team.GetTeamUuid()) + f5.GetSysLog().Info("matchMgr.execMatch team Timeout:%s", m.team.GetTeamUuid()) } } diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index f8d8c6d0..2755a80b 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -7,7 +7,6 @@ import ( "mt" "main/common" "main/constant" - "jccommon" "fmt" "sort" @@ -698,7 +697,7 @@ func (this *team) NeedMatchRealPlayer() bool { if mt.Table.Config.Get().GetMatchRealPlayer() == 0 { return false } - return q5.ToInt32(this.getModeId()) == jccommon.MAP_MODE_BOUNTY + return q5.ToInt32(this.getModeId()) == 2 } func newTeam() *team {