mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Hearts: Move hand sorting functionality into a method
This commit is contained in:
parent
6da481205b
commit
4e3a1f2da9
Notes:
sideshowbarker
2024-07-18 17:24:47 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/4e3a1f2da9a Pull-request: https://github.com/SerenityOS/serenity/pull/7443
2 changed files with 3 additions and 1 deletions
|
@ -111,7 +111,7 @@ void Game::setup(String player_name)
|
|||
}
|
||||
player.hand.append(card);
|
||||
}
|
||||
quick_sort(player.hand, hearts_card_less);
|
||||
player.sort_hand();
|
||||
auto card_position = player.first_card_position;
|
||||
for (auto& card : player.hand) {
|
||||
card->set_position(card_position);
|
||||
|
|
|
@ -30,6 +30,8 @@ public:
|
|||
size_t pick_last_card();
|
||||
bool has_card_of_type(Card::Type type);
|
||||
|
||||
void sort_hand() { quick_sort(hand, hearts_card_less); }
|
||||
|
||||
Vector<RefPtr<Card>> hand;
|
||||
Vector<RefPtr<Card>> cards_taken;
|
||||
Gfx::IntPoint first_card_position;
|
||||
|
|
Loading…
Reference in a new issue