mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +00:00
LibCards+Games: Change name of card type to card suit
Playing cards have a `suit` such as `hearts`/`diamonds`, not a `type`. Make the internal naming consistent with the way playing cards are typically named.
This commit is contained in:
parent
4c5e9f5633
commit
a51fce6c0f
9 changed files with 78 additions and 78 deletions
|
@ -39,9 +39,9 @@ inline CardValue hearts_card_value(Card const& card)
|
|||
|
||||
inline uint8_t hearts_card_points(Card const& card)
|
||||
{
|
||||
if (card.type() == Card::Type::Hearts)
|
||||
if (card.suit() == Card::Suit::Hearts)
|
||||
return 1;
|
||||
else if (card.type() == Card::Type::Spades && hearts_card_value(card) == CardValue::Queen)
|
||||
else if (card.suit() == Card::Suit::Spades && hearts_card_value(card) == CardValue::Queen)
|
||||
return 13;
|
||||
else
|
||||
return 0;
|
||||
|
@ -49,8 +49,8 @@ inline uint8_t hearts_card_points(Card const& card)
|
|||
|
||||
inline bool hearts_card_less(RefPtr<Card>& card1, RefPtr<Card>& card2)
|
||||
{
|
||||
if (card1->type() != card2->type())
|
||||
return card1->type() < card2->type();
|
||||
if (card1->suit() != card2->suit())
|
||||
return card1->suit() < card2->suit();
|
||||
else
|
||||
return hearts_card_value(*card1) < hearts_card_value(*card2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue