Fixed always win state.

This commit is contained in:
2022-01-23 10:31:13 -08:00
parent 0298c4ad1f
commit d1da8bc395

View File

@@ -99,16 +99,22 @@ void conversationQueueBeginBetting() {
} }
void conversationQueueNextBetter() { void conversationQueueNextBetter() {
uint8_t i, j, k; uint8_t i, j, countStillInGame;
// Now we decide the next better. // Now we decide the next better.
countStillInGame = 0;
for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) { for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
//In theory I don't think the current better can ever be selected again. //In theory I don't think the current better can ever be selected again.
if(i == POKER_PLAYER_BETTER) continue; // if(i == POKER_PLAYER_BETTER) continue; // Commented because we now count
// Next better is the better to the right of the current better. // Next better is the better to the right of the current better.
j = (POKER_PLAYER_BETTER + i) % POKER_PLAYER_COUNT_MAX; j = (POKER_PLAYER_BETTER + i) % POKER_PLAYER_COUNT_MAX;
if(!pokerDoesPlayerNeedToBet(j)) continue; if(!pokerDoesPlayerNeedToBet(j)) {
if((POKER_PLAYERS[j].state & (POKER_PLAYER_STATE_FOLDED | POKER_PLAYER_STATE_OUT)) == 0) {
countStillInGame++;
}
continue;
}
// They haven't bet yet, make them the "next better" // They haven't bet yet, make them the "next better"
POKER_PLAYER_BETTER = j; POKER_PLAYER_BETTER = j;
@@ -120,10 +126,7 @@ void conversationQueueNextBetter() {
// If we reach this point then we either need to begin the betting round, or // If we reach this point then we either need to begin the betting round, or
// we are going to move to the winning decider. // we are going to move to the winning decider.
if( if(POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE || countStillInGame == 1) {
POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE ||
pokerGetRemainingBetterCount() <= 1
) {
QUEUE_ITEM = QUEUE_WINNER_DECIDE; QUEUE_ITEM = QUEUE_WINNER_DECIDE;
conversationQueueNext(); conversationQueueNext();
return; return;