2021-10-14 21:32:51 -07:00

46 lines
1.2 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "start.h"
void _pokerGameActionStartOnStart(
queue_t *queue, queueaction_t *action, uint8_t i
) {
queueNext(queue);
}
void _pokerGameActionStartOnEnd(queue_t *queue,queueaction_t *action,uint8_t i){
pokerdiscussiondata_t data;
uint8_t j, k;
pokergame_t *game = (pokergame_t *)action->data;
//TODO: Init Players betterer.
pokerInit(&game->poker);
pokerSetBlinds(
&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);
}
pokerDealerSet(&game->poker, game->poker.playerCount/2);
// Say that.
data.poker = game;
data.reason = POKER_DISCUSSION_REASON_MATCH_START;
pokerDiscussionQueue(&data);
// Begin Round.
pokerGameActionRoundAdd(game);
}
queueaction_t * pokerGameActionStartAdd(pokergame_t *game) {
queueaction_t *action = pokerGameActionAdd(game);
action->onStart = &_pokerGameActionStartOnStart;
action->onEnd = &_pokerGameActionStartOnEnd;
return action;
}