Skip to content

Commit

Permalink
fix: Account for NEX versions in JoinMatchmakeSessionParam
Browse files Browse the repository at this point in the history
I have the strangest feeling that I made this exact commit to 
nex-protocols-go months ago
  • Loading branch information
ashquarky committed Jan 10, 2025
1 parent 07241a0 commit cb7406c
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import semver from 'compare-versions';
import Structure from '@/nex/types/structure';
import UInt32 from '@/nex/types/uint32';
import List from '@/nex/types/list';
Expand All @@ -20,8 +21,8 @@ export default class JoinMatchmakeSessionParam extends Structure {
private strSystemPassword = new RVString();
private joinMessage = new RVString();
private participationCount = new UInt16();
private extraParticipants = new UInt16();
private blockListParam = new MatchmakeBlockListParam();
private extraParticipants: UInt16; // * SV 1 / NEX 4.0
private blockListParam: MatchmakeBlockListParam; // * NEX 4.0

public extractFrom(stream: NEXByteStream): void {
this.extractHeaderFrom(stream);
Expand All @@ -35,8 +36,16 @@ export default class JoinMatchmakeSessionParam extends Structure {
this.strSystemPassword.extractFrom(stream);
this.joinMessage.extractFrom(stream);
this.participationCount.extractFrom(stream);
this.extraParticipants.extractFrom(stream);
this.blockListParam.extractFrom(stream);

if (this.structureVersion >= 1 || semver.satisfies(stream.title.library_versions.match_making, '>=4.0.0')) {
this.extraParticipants = new UInt16();
this.extraParticipants.extractFrom(stream);
}

if (semver.satisfies(stream.title.library_versions.match_making, '>=4.0.0')) {
this.blockListParam = new MatchmakeBlockListParam();
this.blockListParam.extractFrom(stream);
}
}

public new(): this {
Expand All @@ -63,4 +72,4 @@ export default class JoinMatchmakeSessionParam extends Structure {
}
};
}
}
}

0 comments on commit cb7406c

Please sign in to comment.