Made betting work correctly.
This commit is contained in:
@ -65,6 +65,9 @@ void _pokerGameActionBetOnUpdate(
|
||||
break;
|
||||
}
|
||||
|
||||
// Mark as move made.
|
||||
player->state |= POKER_PLAYER_STATE_ROUND_MOVE;
|
||||
|
||||
// Speak
|
||||
discussion.poker = game;
|
||||
discussion.playerCause = game->poker.bet.better;
|
||||
@ -78,7 +81,7 @@ void _pokerGameActionBetOnUpdate(
|
||||
void _pokerGameActionBetOnEnd(
|
||||
queue_t *queue, queueaction_t *action, uint8_t i
|
||||
) {
|
||||
uint8_t j;
|
||||
uint8_t j, k, p;
|
||||
pokerplayer_t *player;
|
||||
queueaction_t *next;
|
||||
pokerdiscussiondata_t discussion;
|
||||
@ -90,18 +93,28 @@ void _pokerGameActionBetOnEnd(
|
||||
playersPending = false;
|
||||
|
||||
// Check if each player needs to action.
|
||||
k = POKER_BET_ROUND_PLAYER_DEFAULT(&game->poker);
|
||||
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
player = game->poker.players + j;
|
||||
if(player->state & POKER_PLAYER_STATE_FOLDED) continue;
|
||||
p = ((k + j) % POKER_PLAYER_COUNT);
|
||||
player = game->poker.players + p;
|
||||
|
||||
if((player->state & POKER_PLAYER_STATE_FOLDED) != 0) continue;
|
||||
if(player->state & POKER_PLAYER_STATE_OUT) continue;
|
||||
if(player->currentBet >= game->poker.bet.currentBet) continue;
|
||||
if(player->state & POKER_PLAYER_STATE_ROUND_MOVE) {
|
||||
if(player->currentBet >= game->poker.bet.currentBet && player) continue;
|
||||
}
|
||||
|
||||
// Yes, this player needs to check, raise or fold
|
||||
game->poker.bet.better = p;
|
||||
pokerGameActionBetAdd(game);
|
||||
playersPending = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Restack
|
||||
pokerGameActionRestackAdd(game);
|
||||
|
||||
// Are we waiting on any players?
|
||||
if(playersPending) return;
|
||||
|
||||
|
@ -12,7 +12,7 @@ void _pokerGameActionRestackOnStart(
|
||||
) {
|
||||
pokergame_t *game = (pokergame_t *)action->data;
|
||||
printf("Restacking\n");
|
||||
// pokerGameQueueRestack(game);
|
||||
pokerGameQueueRestack(game);
|
||||
queueNext(queue);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user