/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "match.h" void _pokerActionMatchOnStart(queue_t *queue, queueaction_t *action, uint8_t i){ poker_t *poker; uint8_t x; poker = (poker_t *)action->data; poker->state = POKER_STATE_STARTING_MATCH; // Reset the main game state. This does not init the round. pokerBetInit(&poker->bet); poker->roundDealer = POKER_PLAYER_COUNT-2; // Reset the players for(x = 0; x < POKER_PLAYER_COUNT; x++) { poker->players[x].state = 0x00; poker->players[x].chips = POKER_BET_PLAYER_CHIPS_DEFAULT; } queueNext(queue); } queueaction_t * pokerActionMatchAdd(queue_t *queue, poker_t *poker) { queueaction_t *action; action = queueAdd(queue); action->data = (void *)poker; action->onStart = &_pokerActionMatchOnStart; return action; }