Fixed crash
This commit is contained in:
Binary file not shown.
@@ -35,9 +35,6 @@ void conversationQueueDealCards() {
|
||||
void conversationQueueBeginBetting() {
|
||||
// Begin the betting process. First we need to decide if the player or the
|
||||
// AI is betting, then based on that we decide what to do next.
|
||||
QUEUE_ITEM = QUEUE_DEBUG;
|
||||
conversationTextboxString(DEBUG_WINNER_DECIDED);
|
||||
return;
|
||||
|
||||
// TODO: Actually bet.
|
||||
if(POKER_PLAYER_BETTER == POKER_HUMAN_INDEX) {
|
||||
@@ -53,7 +50,6 @@ void conversationQueueBeginBetting() {
|
||||
POKER_PLAYER_BETTER
|
||||
].state |= POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
|
||||
}
|
||||
|
||||
QUEUE_ITEM = QUEUE_NEXT_BETTER;
|
||||
conversationQueueNext();
|
||||
}
|
||||
@@ -68,6 +64,7 @@ void conversationQueueNextBetter() {
|
||||
|
||||
// Next better is the better to the right of the current better.
|
||||
j = (POKER_PLAYER_BETTER + i) % POKER_PLAYER_COUNT_MAX;
|
||||
|
||||
|
||||
// Can this player even participate?
|
||||
if(
|
||||
@@ -93,6 +90,7 @@ void conversationQueueNextBetter() {
|
||||
|
||||
// Is the player called into this pot all the way?
|
||||
if(POKER_POTS[k].players[j] == POKER_POTS[k].call) continue;
|
||||
break;
|
||||
}
|
||||
|
||||
// Then skip to next player.
|
||||
@@ -100,8 +98,12 @@ void conversationQueueNextBetter() {
|
||||
}
|
||||
|
||||
// They haven't bet yet, make them the "next better"
|
||||
BGB_printf("NEXT BETTER IS NOW %d", j);
|
||||
POKER_PLAYER_BETTER = j;
|
||||
conversationQueueNext();
|
||||
|
||||
QUEUE_ITEM = QUEUE_BEGIN_BETTING;
|
||||
conversationPause(1);
|
||||
// conversationQueueNext();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -233,7 +235,8 @@ inline void conversationQueueInit() {
|
||||
}
|
||||
|
||||
inline void conversationQueueNext() {
|
||||
if(QUEUE_ITEM > 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]();
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -32,4 +32,6 @@ extern uint16_t POKER_GAME_BLINDS_CURRENT;
|
||||
|
||||
void pokerInit();
|
||||
|
||||
void pokerNewRound();
|
||||
void pokerNewRound();
|
||||
|
||||
inline void pokerBet(uint8_t player, uint16_t amount);
|
@@ -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;
|
||||
extern uint8_t POKER_POT_COUNT;
|
Reference in New Issue
Block a user