-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ranking): Add RankingModes constants for GetRanking.rankingMode #79
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,3 +92,25 @@ func (protocol *Protocol) handleGetRanking(packet nex.PacketInterface) { | |
|
||
globals.Respond(packet, rmcMessage) | ||
} | ||
|
||
type rankingModes struct { | ||
// Global leaderboards | ||
Global uint8 | ||
// Ranks close to caller on global leaderboards | ||
NearbyGlobal uint8 | ||
// Friends of caller only | ||
Friends uint8 | ||
// Ranks close to caller on friends leaderboards | ||
NearbyFriends uint8 | ||
// Rank of caller only | ||
Self uint8 | ||
} | ||
|
||
// RankingModes is an enum of all the types of ranking request that can be made in the GetRanking method | ||
var RankingModes = rankingModes{ | ||
Global: 0, | ||
NearbyGlobal: 1, | ||
Friends: 2, | ||
NearbyFriends: 3, | ||
Self: 4, | ||
} | ||
Comment on lines
+96
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this should be on the same file as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with Dani. Having it in it's own file would make it line up with all of our other constants definition files, like those in nex-go and https://github.com/PretendoNetwork/nex-protocols-go/blob/master/match-making/gathering_flags.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For cases like this where we emulate an enum where each value is sequential, we can avoid defining each value manually by using
iota
(which defaults to 0). See https://github.com/PretendoNetwork/nex-go/tree/master/constants for examplesHowever that only applies to cases where each value is defined as its own variable, it's not applicable in this case. How you have it is fine, but wanted to give you all the options 👍