-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Use natural sorting for map lists (Fixes #892) #907
Conversation
0d9a6c0
to
ef77973
Compare
core/logic/smn_maplists.cpp
Outdated
// if only the right character is a digit, we have a result | ||
if (r_digit) return +1; | ||
// compute the difference of both characters | ||
const int diff=l_char - r_char; |
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.
Nit : add spaces around "=" to match everything else.
core/logic/smn_maplists.cpp
Outdated
while (*l && alphanum_isdigit(*l)) | ||
{ | ||
// TODO: this can overflow | ||
l_int=l_int * 10 + *l - '0'; |
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.
ditto
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.
Looks good, Only question I have is should we be concerned with the possibility of overflows?
ef77973
to
9f72399
Compare
I think we can probably survive slightly incorrect map sorting past 4,294,967,295 alphabetically-identical maps. |
This produces consistently better results, especially for games such as L4D(2).