Minor bug fixing, added blinds round

This commit is contained in:
2021-07-29 08:00:26 -07:00
parent ddf4bcdeaf
commit 6a666b64ca
9 changed files with 69 additions and 9 deletions

View File

@ -0,0 +1,26 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "blinds.h"
void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i) {
poker_t *poker;
poker = (poker_t *)action->data;
pokerBetTakeBlinds(poker);
printf("Taken Blinds\n");
queueNext(queue);
}
queueaction_t * pokerActionBlindsAdd(queue_t *queue, poker_t *poker) {
queueaction_t *action;
action = queueAdd(queue);
action->data = (void *)poker;
action->onStart = &_pokerActionBlindsOnStart;
return action;
}

View File

@ -0,0 +1,23 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "../../display/animation/queue.h"
#include "../bet.h"
/** Callback for the blinds action */
void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i);
/**
* Adds a blinds action onto the specified queue.
*
* @param queue Queue to add to.
* @param poker Poker game instance to deal.
* @return The queued action.
*/
queueaction_t * pokerActionBlindsAdd(queue_t *queue, poker_t *poker);

View File

@ -10,6 +10,14 @@
#include "../../display/animation/queue.h"
#include "../dealer.h"
/** Callback for the deal action */
void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i);
/**
* Adds a deal action onto the specified queue.
*
* @param queue Queue to add to.
* @param poker Poker game instance to deal.
* @return The queued action.
*/
queueaction_t * pokerActionDealAdd(queue_t *queue, poker_t *poker);

View File

@ -16,7 +16,6 @@ void _pokerActionMatchOnStart(queue_t *queue, queueaction_t *action, uint8_t i){
// Reset the main game state. This does not init the round.
pokerBetInit(&poker->bet);
poker->roundDealer = POKER_PLAYER_COUNT-2;
poker->round = POKER_ROUND_MATCH;
for(x = 0; x < POKER_PLAYER_COUNT; x++) {
poker->players[x].state = 0x00;

View File

@ -15,10 +15,7 @@ void _pokerActionRoundOnStart(queue_t *queue, queueaction_t *action ,uint8_t i){
poker = (poker_t *)action->data;
poker->round = POKER_ROUND_START;
// Prepare the initial game state
poker->round = POKER_ROUND_DEAL;
pokerBetReset(&poker->bet);
pokerDealerInit(&poker->dealer);