From 2539954deacc57242d2a37adbf6b5d5c6a404c5e Mon Sep 17 00:00:00 2001 From: MeirGavish Date: Sun, 17 Aug 2025 11:10:00 +0300 Subject: [PATCH] Fixed build error from previous merge and applied review comments --- include/card.h | 2 +- source/joker_effects.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/card.h b/include/card.h index 9831013..e403b33 100644 --- a/include/card.h +++ b/include/card.h @@ -35,7 +35,7 @@ #define NUM_RANKS 13 #define RANK_OFFSET 2 // Because the first rank is 2 and ranks start at 0 -#define IMPOSSIBLY_HIGH_CARD_VALUE 99 +#define IMPOSSIBLY_HIGH_CARD_VALUE 100 // Card types typedef struct diff --git a/source/joker_effects.c b/source/joker_effects.c index 36b6197..7cbb0d3 100644 --- a/source/joker_effects.c +++ b/source/joker_effects.c @@ -313,15 +313,15 @@ static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card) { // Aces are always considered high value, even in an ace-low straight u8 lowest_value = IMPOSSIBLY_HIGH_CARD_VALUE; CardObject** hand = get_hand_array(); - int hand_top = get_hand_top(); - for (int i = 0; i < hand_top; i++ ) + int hand_size = hand_get_size(); + for (int i = 0; i < hand_size; i++ ) { u8 value = card_get_value(hand[i]->card); if (lowest_value > value) lowest_value = value; } - if (lowest_value != 99) + if (lowest_value != IMPOSSIBLY_HIGH_CARD_VALUE) effect.mult = lowest_value * 2; return effect; @@ -333,8 +333,8 @@ static JokerEffect reserved_parking_joker_effect(Joker *joker, Card *scored_card return effect; // if card != null, we are not at the end-phase of scoring yet CardObject** hand = get_hand_array(); - int hand_top = get_hand_top(); - for (int i = 0; i < hand_top; i++ ) + int hand_size = hand_get_size(); + for (int i = 0; i < hand_size; i++ ) { switch (hand[i]->card->rank) { case KING: case QUEEN: case JACK: @@ -356,13 +356,11 @@ static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) { switch (scored_card->rank) { case KING: case QUEEN: case JACK: if (random() % 2 == 0) - effect.money = 1; + effect.money = 2; default: break; } - effect.chips = 1; - return effect; } @@ -400,8 +398,8 @@ static JokerEffect abstract_joker_effect(Joker *joker, Card *scored_card) { return effect; // if card != null, we are not at the end-phase of scoring yet // +1 xmult per occupied joker slot - int jokers_top = get_jokers_top(); - effect.mult = (jokers_top + 1) * 3; + int num_jokers = list_get_size(get_jokers()); + effect.mult = num_jokers * 3; return effect; }