Skip to content

Commit

Permalink
Merge pull request #80 from DaniElectra/nex-1-matchmaking
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbarrow authored Jun 30, 2024
2 parents 2def9e2 + bacd113 commit ac245e2
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions match-making/types/matchmake_session_search_criteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type MatchmakeSessionSearchCriteria struct {
types.Structure
Attribs *types.List[*types.String]
GameMode *types.String
MinParticipants *types.String
MaxParticipants *types.String
MinParticipants *types.String // * NEX v2.0.0
MaxParticipants *types.String // * NEX v2.0.0
MatchmakeSystemType *types.String
VacantOnly *types.PrimitiveBool
ExcludeLocked *types.PrimitiveBool
Expand All @@ -39,8 +39,15 @@ func (mssc *MatchmakeSessionSearchCriteria) WriteTo(writable types.Writable) {

mssc.Attribs.WriteTo(contentWritable)
mssc.GameMode.WriteTo(contentWritable)
mssc.MinParticipants.WriteTo(contentWritable)
mssc.MaxParticipants.WriteTo(contentWritable)

if libraryVersion.GreaterOrEqual("2.0.0") {
mssc.MinParticipants.WriteTo(contentWritable)
}

if libraryVersion.GreaterOrEqual("2.0.0") {
mssc.MaxParticipants.WriteTo(contentWritable)
}

mssc.MatchmakeSystemType.WriteTo(contentWritable)
mssc.VacantOnly.WriteTo(contentWritable)
mssc.ExcludeLocked.WriteTo(contentWritable)
Expand Down Expand Up @@ -107,14 +114,18 @@ func (mssc *MatchmakeSessionSearchCriteria) ExtractFrom(readable types.Readable)
return fmt.Errorf("Failed to extract MatchmakeSessionSearchCriteria.GameMode. %s", err.Error())
}

err = mssc.MinParticipants.ExtractFrom(readable)
if err != nil {
return fmt.Errorf("Failed to extract MatchmakeSessionSearchCriteria.MinParticipants. %s", err.Error())
if libraryVersion.GreaterOrEqual("2.0.0") {
err = mssc.MinParticipants.ExtractFrom(readable)
if err != nil {
return fmt.Errorf("Failed to extract MatchmakeSessionSearchCriteria.MinParticipants. %s", err.Error())
}
}

err = mssc.MaxParticipants.ExtractFrom(readable)
if err != nil {
return fmt.Errorf("Failed to extract MatchmakeSessionSearchCriteria.MaxParticipants. %s", err.Error())
if libraryVersion.GreaterOrEqual("2.0.0") {
err = mssc.MaxParticipants.ExtractFrom(readable)
if err != nil {
return fmt.Errorf("Failed to extract MatchmakeSessionSearchCriteria.MaxParticipants. %s", err.Error())
}
}

err = mssc.MatchmakeSystemType.ExtractFrom(readable)
Expand Down

0 comments on commit ac245e2

Please sign in to comment.