Add a "is_card_face" function to take into account if Pareidolia is present

This commit is contained in:
MonteCrysto
2025-09-30 22:47:00 +02:00
parent 74739d87ed
commit c781ee9666
4 changed files with 34 additions and 16 deletions
+23
View File
@@ -161,6 +161,18 @@ List *get_jokers(void) {
return jokers;
}
bool is_joker_present(int joker_id) {
for (int k = 0; k < list_get_size(jokers); k++)
{
JokerObject *joker = list_get(jokers, k);
if (joker->joker->id == joker_id)
{
return true;
}
}
return false;
}
void add_joker(JokerObject *joker_object)
{
list_append(jokers, joker_object);
@@ -423,6 +435,17 @@ enum HandType hand_get_type()
return res_hand_type; // should be HIGH_CARD
}
// Returns true if the card is *considered* a face card
bool card_is_face(Card *card) {
// Card is a face card, or Pareidolia is present
return (
card->rank == JACK ||
card->rank == QUEEN ||
card->rank == KING ||
is_joker_present(PAREIDOLIA_JOKER_ID)
);
}
/* Copies the appropriate item into the top left panel (blind/shop icon)
* from where it was put outside the screenview
*/