Fixed crash

This commit is contained in:
2022-01-11 07:58:21 -08:00
parent 18260920b4
commit 5620d6c517
5 changed files with 31 additions and 25 deletions

View File

@@ -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;
}