Use natural sorting for map lists (Fixes #892)#907
Merged
Conversation
0d9a6c0 to
ef77973
Compare
Drifter321
reviewed
Oct 11, 2018
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; |
Member
There was a problem hiding this comment.
Nit : add spaces around "=" to match everything else.
Drifter321
reviewed
Oct 11, 2018
core/logic/smn_maplists.cpp
Outdated
| while (*l && alphanum_isdigit(*l)) | ||
| { | ||
| // TODO: this can overflow | ||
| l_int=l_int * 10 + *l - '0'; |
Drifter321
approved these changes
Oct 11, 2018
Member
Drifter321
left a comment
There was a problem hiding this comment.
Looks good, Only question I have is should we be concerned with the possibility of overflows?
ef77973 to
9f72399
Compare
Member
Author
I think we can probably survive slightly incorrect map sorting past 4,294,967,295 alphabetically-identical maps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This produces consistently better results, especially for games such as L4D(2).