Optimize "whole hand" conditions checks for Joker effects (#213)
* Introduce a ContainedHandTypes type * Separate computing of hand_type and _contained_hand_types variables --------- Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
+32
-1
@@ -84,10 +84,10 @@ enum HandType
|
||||
PAIR,
|
||||
TWO_PAIR,
|
||||
THREE_OF_A_KIND,
|
||||
FOUR_OF_A_KIND,
|
||||
STRAIGHT,
|
||||
FLUSH,
|
||||
FULL_HOUSE,
|
||||
FOUR_OF_A_KIND,
|
||||
STRAIGHT_FLUSH,
|
||||
ROYAL_FLUSH,
|
||||
FIVE_OF_A_KIND,
|
||||
@@ -95,6 +95,34 @@ enum HandType
|
||||
FLUSH_FIVE
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
// Store all contained hands to optimize "whole hand condition" Jokers
|
||||
typedef struct ContainedHandTypes
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u16 HIGH_CARD : 1;
|
||||
u16 PAIR : 1;
|
||||
u16 TWO_PAIR : 1;
|
||||
u16 THREE_OF_A_KIND : 1;
|
||||
u16 STRAIGHT : 1;
|
||||
u16 FLUSH : 1;
|
||||
u16 FULL_HOUSE : 1;
|
||||
u16 FOUR_OF_A_KIND : 1;
|
||||
u16 STRAIGHT_FLUSH : 1;
|
||||
u16 ROYAL_FLUSH : 1;
|
||||
u16 FIVE_OF_A_KIND : 1;
|
||||
u16 FLUSH_HOUSE : 1;
|
||||
u16 FLUSH_FIVE : 1;
|
||||
u16 : 3;
|
||||
};
|
||||
u16 value;
|
||||
};
|
||||
} ContainedHandTypes;
|
||||
// clang-format on
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int substate;
|
||||
@@ -119,6 +147,9 @@ bool card_is_face(Card* card);
|
||||
List* get_jokers_list(void);
|
||||
List* get_expired_jokers_list(void);
|
||||
|
||||
ContainedHandTypes* get_contained_hands(void);
|
||||
enum HandType* get_hand_type(void);
|
||||
|
||||
int get_deck_top(void);
|
||||
int get_num_discards_remaining(void);
|
||||
int get_num_hands_remaining(void);
|
||||
|
||||
Reference in New Issue
Block a user