Skip to content

Commit

Permalink
Change AutoMatchmakeWithParam_Postpone to use SearchCriteria
Browse files Browse the repository at this point in the history
This should allow for more precise matchmaking
Also changes SearchMatchmakeSession to GameMatchmakeSession since a SearchCriteria session won't have a searchMatchmakeSession
  • Loading branch information
shutterbug2000 committed Oct 14, 2023
1 parent 74e821b commit 942f04d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions globals/matchmaking_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func FindSessionsByMatchmakeSessionSearchCriterias(lstSearchCriteria []*match_ma
continue
}

if session.SearchMatchmakeSession.MinimumParticipants < uint16(min) {
if session.GameMatchmakeSession.MinimumParticipants < uint16(min) {
continue
}
}
Expand All @@ -267,7 +267,7 @@ func FindSessionsByMatchmakeSessionSearchCriterias(lstSearchCriteria []*match_ma
continue
}

if session.SearchMatchmakeSession.MinimumParticipants > uint16(max) {
if session.GameMatchmakeSession.MinimumParticipants > uint16(max) {
continue
}
}
Expand All @@ -289,7 +289,7 @@ func FindSessionsByMatchmakeSessionSearchCriterias(lstSearchCriteria []*match_ma
continue
}

if session.SearchMatchmakeSession.MaximumParticipants < uint16(min) {
if session.GameMatchmakeSession.MaximumParticipants < uint16(min) {
continue
}
}
Expand All @@ -301,7 +301,7 @@ func FindSessionsByMatchmakeSessionSearchCriterias(lstSearchCriteria []*match_ma
continue
}

if session.SearchMatchmakeSession.MaximumParticipants > uint16(max) {
if session.GameMatchmakeSession.MaximumParticipants > uint16(max) {
continue
}
}
Expand Down
14 changes: 7 additions & 7 deletions matchmake-extension/auto_matchmake_with_param_postpone.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func autoMatchmakeWithParam_Postpone(err error, client *nex.Client, callID uint32, autoMatchmakeParam *match_making_types.AutoMatchmakeParam) uint32 {
if commonMatchmakeExtensionProtocol.cleanupSearchMatchmakeSessionHandler == nil {
if commonMatchmakeExtensionProtocol.cleanupMatchmakeSessionSearchCriteriaHandler == nil {
logger.Warning("MatchmakeExtension::AutoMatchmake_Postpone missing CleanupSearchMatchmakeSessionHandler!")
return nex.Errors.Core.NotImplemented
}
Expand All @@ -27,20 +27,20 @@ func autoMatchmakeWithParam_Postpone(err error, client *nex.Client, callID uint3
var matchmakeSession *match_making_types.MatchmakeSession
matchmakeSession = autoMatchmakeParam.SourceMatchmakeSession

searchMatchmakeSession := matchmakeSession.Copy().(*match_making_types.MatchmakeSession)
commonMatchmakeExtensionProtocol.cleanupSearchMatchmakeSessionHandler(searchMatchmakeSession)
sessionIndex := common_globals.FindSessionByMatchmakeSession(searchMatchmakeSession)
commonMatchmakeExtensionProtocol.cleanupMatchmakeSessionSearchCriteriaHandler(autoMatchmakeParam.LstSearchCriteria)

sessions := common_globals.FindSessionsByMatchmakeSessionSearchCriterias(autoMatchmakeParam.LstSearchCriteria, commonMatchmakeExtensionProtocol.gameSpecificMatchmakeSessionSearchCriteriaChecksHandler)
var session *common_globals.CommonMatchmakeSession

if sessionIndex == 0 {
if len(sessions) == 0 {
var errCode uint32
session, err, errCode = common_globals.CreateSessionByMatchmakeSession(matchmakeSession, searchMatchmakeSession, client.PID())
session, err, errCode = common_globals.CreateSessionBySearchCriteria(matchmakeSession, autoMatchmakeParam.LstSearchCriteria, client.PID())
if err != nil {
logger.Error(err.Error())
return errCode
}
} else {
session = common_globals.Sessions[sessionIndex]
session = sessions[0]
}

err, errCode := common_globals.AddPlayersToSession(session, []uint32{client.ConnectionID()}, client, "")
Expand Down

0 comments on commit 942f04d

Please sign in to comment.