diff --git a/src/conversation/queue.c b/src/conversation/queue.c index 9485b62..6db48d0 100644 --- a/src/conversation/queue.c +++ b/src/conversation/queue.c @@ -99,16 +99,22 @@ void conversationQueueBeginBetting() { } void conversationQueueNextBetter() { - uint8_t i, j, k; + uint8_t i, j, countStillInGame; // Now we decide the next better. + countStillInGame = 0; for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) { //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. 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" 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 // we are going to move to the winning decider. - if( - POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE || - pokerGetRemainingBetterCount() <= 1 - ) { + if(POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE || countStillInGame == 1) { QUEUE_ITEM = QUEUE_WINNER_DECIDE; conversationQueueNext(); return;