More code cleaning.

This commit is contained in:
2021-10-12 09:25:42 -07:00
parent 01b49c364c
commit af03b89e50
13 changed files with 32 additions and 262 deletions

View File

@ -12,21 +12,38 @@ void _pokerGameActionFlopOnStart(
) {
pokergame_t *game = (pokergame_t *)action->data;
pokerdiscussiondata_t discussion;
queueaction_t *next;
bool hasDoneFlop;
// Prep convo
discussion.poker = game;
// Get how many players are left in the round.
if(pokerInRoundGetCount(&game->poker) > 1) {// Still more than 1
// Add the actual flop action.
next = pokerActionNextFlopAdd(queue, &game->poker);
// Reset all the players
pokerResetBettingRound(&game->poker);
// Do actual flop action
hasDoneFlop = true;
switch(game->poker.communitySize) {
case 0x00:
pokerBurn(&game->poker, POKER_FLOP_BURN_COUNT);
pokerTurn(&game->poker, POKER_FLOP_CARD_COUNT);
break;
case POKER_FLOP_CARD_COUNT:
pokerBurn(&game->poker, POKER_FLOP_BURN_COUNT);
pokerTurn(&game->poker, POKER_TURN_CARD_COUNT);
break;
case POKER_FLOP_CARD_COUNT+POKER_TURN_CARD_COUNT:
pokerBurn(&game->poker, POKER_FLOP_BURN_COUNT);
pokerTurn(&game->poker, POKER_RIVER_CARD_COUNT);
break;
default:
hasDoneFlop = false;
break;
}
// Is there any flop "left to do" ?
if(next != NULL) {
if(hasDoneFlop) {
// Talk about it.
discussion.reason = POKER_DISCUSSION_REASON_FLOP;
pokerDiscussionQueue(&discussion);

View File

@ -12,7 +12,6 @@
#include "restack.h"
#include "winner.h"
#include "bet.h"
#include "../../../poker/actions/flop.h"
/** Callback that is fired when the flop action starts */
void _pokerGameActionFlopOnStart(

View File

@ -20,30 +20,26 @@ void _pokerGameActionRoundOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
// Start the round
pokerResetRound(&game->poker);
pokerNewDealer(&game->poker);
pokerTakeBlinds(&game->poker, game->poker.blindSmall, game->poker.blindBig);
// Speak
data.poker = game;
data.reason = POKER_DISCUSSION_REASON_ROUND_START;
pokerDiscussionQueue(&data);
// Take the blinds.
pokerActionBlindsAdd(queue, &game->poker);
// Speak
data.reason = POKER_DISCUSSION_REASON_BLINDS_TAKEN;
pokerDiscussionQueue(&data);
// Deal
pokerActionDealAdd(queue, &game->poker);
cardShuffle(&game->poker.deck, CARD_DECK_SIZE);
pokerPlayerDealAll(&game->poker, POKER_PLAYER_HAND_SIZE_MAX);
// Speak
data.reason = POKER_DISCUSSION_REASON_DEAL;
pokerDiscussionQueue(&data);
// Begin Betting Round. This will queue for one player only and then the round
// will take over.
pokerResetBettingRound(&game->poker);
// Begin Betting Round
pokerGameActionBetAdd(game);
}

View File

@ -5,8 +5,6 @@
#pragma once
#include "../../../libs.h"
#include "../../../poker/actions/blinds.h"
#include "../../../poker/actions/deal.h"
#include "action.h"
#include "../pokerdiscussion.h"
#include "bet.h"

View File

@ -24,12 +24,10 @@ void _pokerGameActionStartOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
&game->poker, POKER_BET_BLIND_SMALL_DEFAULT, POKER_BET_BLIND_BIG_DEFAULT
);
for(j = 0; j < POKER_PLAYER_COUNT_MAX; j++) {
k = pokerPlayerAdd(&game->poker);
pokerPlayerChipsAdd(
game->poker.players + k,
POKER_BET_PLAYER_CHIPS_DEFAULT
);
k = pokerPlayerAdd(&game->poker);
pokerPlayerChipsAdd(game->poker.players+k, POKER_BET_PLAYER_CHIPS_DEFAULT);
}
pokerSetDealer(&game->poker, game->poker.playerCount/2);
// Say that.
data.poker = game;