Skip to content
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

Smarter Mana Cost sorting #3008

Merged
merged 1 commit into from
Jan 19, 2018
Merged

Smarter Mana Cost sorting #3008

merged 1 commit into from
Jan 19, 2018

Conversation

ZeldaZach
Copy link
Member

Fixes #3006

If you input a partial mana cost, all cards that meet that mana cost requirement will appear.

Sort the mana costs input as well so UU1 == U1U == 1UU == uu1 == ...

Examples:
screenshot 2018-01-10 20 17 21
screenshot 2018-01-10 20 17 33

Copy link
Member

@tooomm tooomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Lower case input now works, too!
  • Order isn't strict anymore (gb finds "Abrupt Decay" as well)

The Mana Cost filter is finally intuitive and usable! Well done, Zach. 👍

Can you please check the code itself, @Daenyth?

Copy link
Contributor

@ctrlaltca ctrlaltca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a nice addition; it will just make the filter a bit slower because of the repeated toUpper() calls.

@ZeldaZach
Copy link
Member Author

@ctrlaltca Do you think using the Qt::CaseInsensitive check would be more efficient?

@ZeldaZach ZeldaZach merged commit 5757d60 into Cockatrice:master Jan 19, 2018
@ZeldaZach ZeldaZach deleted the fix_3006 branch January 19, 2018 00:25
@ctrlaltca
Copy link
Contributor

ctrlaltca commented Jan 19, 2018

Do you think using the Qt::CaseInsensitive check would be more efficient?

Maybe a little bit, since the Qt implementation of indexOf() is comparing characters one by one, but since mana cost strings are typically really short, it won't be noticeable.
Of course i'd love to be proven wrong with some actual performance benchmark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants