From 5620d6c5173c1f6f43928907afc0c6e55d386b9d Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Tue, 11 Jan 2022 07:58:21 -0800 Subject: [PATCH] Fixed crash --- assets/images/font2.aseprite | Bin 558 -> 667 bytes src/conversation/queue.c | 15 +++++++++------ src/poker/poker.c | 20 ++++++++++++++++++-- src/poker/poker.h | 4 +++- src/poker/pot.h | 17 +---------------- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/assets/images/font2.aseprite b/assets/images/font2.aseprite index 03b6034bc617fbd22f685e519cc6512faeb3fc8e..00f4f16453d707139d96f1815336bcbe7f85bde0 100644 GIT binary patch delta 390 zcmV;10eSwe1e*l`n~?#30viI6f{p=;lMw+Ne^l9$!!QVAtpES#tw9_n*-SfoJfUgr z#KuA#F%|?%1p8<6Ym_}=Kkr5C(ady1EjVG@A&J~cnIgZZ=6LKD*B ze=U6eqN&qtKk2LWr3$5tjd(FW)|a_hzYAdnybkFI{h4Ey!yj_j0<~VVI>k@Kt9Y>%&dFc%Sbve`xu8;=8G@ kNUtw&B;=Ow=M6U)3qJumAu6 delta 281 zcmV+!0p|Xj1+D}EE|CF$0V!MCIrNGYj?Z7ExDdn z!4N<(U>IhYU(CbAx+u!t}#Big1J@<}r!pz7?6ftZ<9Z13f1&d;~3h zu+T(5rznYd%ZIR^`D~NU!zecq9$RXdx zf0qj{omcxxU+*tfIAs}X5q#_~YcYNcV+XPiD-e$V97pPWjYys)K;9?Ioo3}Y@?KwX zu5%k-JOJDH?({{DJ=5N4>$j2xzu^OQgi6?!qvegQ96qUEJ8{hJ#CKP}t%HZ`+RJPG f#ihP4Z QUEUE_WINNER_DECIDE) return; + BGB_printf("Doing %d", QUEUE_ITEM); + if(QUEUE_ITEM >= QUEUE_WINNER_DECIDE) return; if(QUEUE_CALLBACKS[QUEUE_ITEM] == NULL) return; QUEUE_CALLBACKS[QUEUE_ITEM](); } \ No newline at end of file diff --git a/src/poker/poker.c b/src/poker/poker.c index 3acc9c0..64bdaaf 100644 --- a/src/poker/poker.c +++ b/src/poker/poker.c @@ -107,10 +107,26 @@ void pokerNewRound() { // Take blinds // TODO: I need to make sure the blind players even have the chips to blind. - POKER_POT_BET(POKER_PLAYER_SMALL_BLIND, POKER_GAME_BLINDS_CURRENT); - POKER_POT_BET(POKER_PLAYER_BIG_BLIND, (POKER_GAME_BLINDS_CURRENT*2)); + pokerBet(POKER_PLAYER_SMALL_BLIND, POKER_GAME_BLINDS_CURRENT); + pokerBet(POKER_PLAYER_BIG_BLIND, (POKER_GAME_BLINDS_CURRENT*2)); // Set the initial better, we set this to the BIG BLIND player because we will // cycle to the "next better" as soon as the game starts. POKER_PLAYER_BETTER = POKER_PLAYER_BIG_BLIND; +} + +inline void pokerBet(uint8_t player, uint16_t amount) { +// TODO: This may become a function because if a player doesn't have enough +// chips to bet to the active pot, then the pot needs to autosplit, take those +// who have bet into the pot up to the amount that the player betting can bet, +// and push them into a new pot. +// There also needs to be a limit on this, for example; +// player 0 has $1200, and bets $1000, he can't bet more than that ever. +// player 1 has $1000, and bets all of it. The remanin +// player 2 has $700, and bets all o it. A new $300 sidepot auto creates +// player 3 has $500 and bets all of it, Another sidepot with $200 is auto made. + + POKER_PLAYERS[player].chips -= amount;\ + POKER_POTS[POKER_POT_CURRENT].chips += amount;\ + POKER_POTS[POKER_POT_CURRENT].call = amount; } \ No newline at end of file diff --git a/src/poker/poker.h b/src/poker/poker.h index 7044a87..e484133 100644 --- a/src/poker/poker.h +++ b/src/poker/poker.h @@ -32,4 +32,6 @@ extern uint16_t POKER_GAME_BLINDS_CURRENT; void pokerInit(); -void pokerNewRound(); \ No newline at end of file +void pokerNewRound(); + +inline void pokerBet(uint8_t player, uint16_t amount); \ No newline at end of file diff --git a/src/poker/pot.h b/src/poker/pot.h index 62ebee1..a0dfc3c 100644 --- a/src/poker/pot.h +++ b/src/poker/pot.h @@ -24,19 +24,4 @@ typedef struct { extern pokerpot_t POKER_POTS[]; extern uint8_t POKER_POT_CURRENT; -extern uint8_t POKER_POT_COUNT; - - -// TODO: This may become a function because if a player doesn't have enough -// chips to bet to the active pot, then the pot needs to autosplit, take those -// who have bet into the pot up to the amount that the player betting can bet, -// and push them into a new pot. -// There also needs to be a limit on this, for example; -// player 0 has $1200, and bets $1000, he can't bet more than that ever. -// player 1 has $1000, and bets all of it. The remanin -// player 2 has $700, and bets all o it. A new $300 sidepot auto creates -// player 3 has $500 and bets all of it, Another sidepot with $200 is auto made. -#define POKER_POT_BET(player, amount) \ - POKER_PLAYERS[player].chips -= amount;\ - POKER_POTS[POKER_POT_CURRENT].chips += amount;\ - POKER_POTS[POKER_POT_CURRENT].call = amount; \ No newline at end of file +extern uint8_t POKER_POT_COUNT; \ No newline at end of file