Hearts: Move hand sorting functionality into a method

This commit is contained in:
Gunnar Beutner 2021-05-24 10:27:05 +02:00 committed by Andreas Kling
parent 6da481205b
commit 4e3a1f2da9
Notes: sideshowbarker 2024-07-18 17:24:47 +09:00
2 changed files with 3 additions and 1 deletions

View file

@ -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);

View file

@ -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;