Added Linux Support, Improved code cleanliness

This commit is contained in:
2021-07-13 08:36:25 -07:00
parent 8b45b976d4
commit 6b027e6e4e
18 changed files with 110 additions and 75 deletions

View File

@ -22,4 +22,6 @@
// Windows Fixes
# define strtok_r strtok_s
# define sleep(n) _sleep(n)
#else
#include <unistd.h>
#endif

View File

@ -13,14 +13,28 @@
#include "../display/primitive.h"
/** How many cards the dealer can hold in their hand */
#define POKER_DEALER_HAND 5
#define POKER_DEALER_HAND_SIZE 5
/** How many cards the grave can hold */
#define POKER_DEALER_GRAVE_SIZE CARD_DECK_SIZE
/** Representation of the dealer state */
typedef struct {
/** Current Card Deck */
card_t deck[CARD_DECK_SIZE];
uint8_t deckSize;
/** Dealer Hand */
card_t cards[POKER_DEALER_HAND];
card_t cards[POKER_DEALER_HAND_SIZE];
uint8_t cardsFacing;
/** Card grave (where spent cards go when burned */
card_t grave[POKER_DEALER_GRAVE_SIZE];
uint8_t graveSize;
// Rendering assets (unfinished)
texture_t dealerTexture;
tileset_t dealerTileset;
primitive_t dealerPrimitive;

View File

@ -35,9 +35,6 @@
#define POKER_ROUND_BET3 0x0A
#define POKER_ROUND_WINNER 0x0B
/** How many cards the grave can hold */
#define POKER_GRAVE_SIZE CARD_DECK_SIZE
/** GUI Height fix (To keep gui scaling nicely we use a fixed height) */
#define POKER_GUI_HEIGHT 2160
@ -47,18 +44,10 @@
#define POKER_FLOP_CARD_COUNT 3
#define POKER_TURN_CARD_COUNT 1
#define POKER_RIVER_CARD_COUNT 1
typedef struct {
//////////////////////////////////////////////////////////////////////////////
// Poker Logic Variables
//////////////////////////////////////////////////////////////////////////////
/** Current Card Deck */
card_t deck[CARD_DECK_SIZE];
uint8_t deckSize;
/** Card grave (where spent cards go when burned */
card_t grave[POKER_GRAVE_SIZE];
uint8_t graveSize;
/** Poker betting state */
pokerbet_t bet;

View File

@ -11,7 +11,7 @@
#include "dealer.h"
/** Size of the FULL hand used to calculate a winning. */
#define POKER_WINNING_FULL_SIZE POKER_PLAYER_HAND+POKER_DEALER_HAND
#define POKER_WINNING_FULL_SIZE POKER_PLAYER_HAND+POKER_DEALER_HAND_SIZE
/** How many cards make a winning set */
#define POKER_WINNING_SET_SIZE 5

View File

@ -15,4 +15,4 @@
* @param right The right element in the array.
* @return -1 for Left priority, 1 for Right and 0 for Equal.
*/
typedef int32_t *arraysort_t(void*, void*);
typedef int32_t arraysort_t(const void*, const void*);