Minor fixes to some std::sort calls #3967
Merged
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.
Related Ticket(s)
Short roundup of the initial problem
A few (3) calls to std::sort fed it a non-strict comparison operator. However, the standard requires the comparison to be strict. Depending on the standard library with which Cockatrice was compiled, those calls were prone to crashes (e.g. on Mac OSX with apple clang and libc++).
Two of these comparison operators were also incorrectly reversed (causing a minor bug in the manage sets dialog, c.f. screenshots for an example).
What will change with this Pull Request?
Screenshots
example of the manage sets bug:
Clicking on "move down" with the second and third row selected swapped the 2nd and 3rd row, then the 3rd and 4th row (and added the 3rd row to the selection) instead of swapping the 3rd and 4th row before swapping the 2nd and 3rd row.