/**
 * 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;
  pokergame_t *game = (pokergame_t *)action->data;

  // Begin the match
  pokerActionMatchAdd(&game->scene.conversation.actionQueue, &game->poker);

  // 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;
}