45 lines
915 B
C
45 lines
915 B
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "deal.h"
|
|
|
|
pokeraction_t actionDeal() {
|
|
return (pokeraction_t){
|
|
.init = &actionDealInit,
|
|
.update = &actionDealUpdate,
|
|
.dispose = &actionDealDispose
|
|
};
|
|
}
|
|
|
|
void actionDealInit(int32_t index, void *data) {
|
|
uint8_t i, j;
|
|
pokerplayer_t *player;
|
|
logText("Dealing Cards");
|
|
|
|
for(i = 0; i < 2; i++) {
|
|
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
|
player = GAME_STATE.players + j;
|
|
cardDeal(GAME_STATE.deck,
|
|
player->cards,
|
|
GAME_STATE.deckSize,
|
|
player->cardCount
|
|
);
|
|
GAME_STATE.deckSize--;
|
|
player->cardCount++;
|
|
}
|
|
}
|
|
|
|
pokerActionRemove(index);
|
|
}
|
|
|
|
void actionDealUpdate(int32_t i, void *data) {
|
|
|
|
}
|
|
|
|
void actionDealDispose(int32_t i, void *data) {
|
|
int32_t newI = pokerActionAdd(actionAi());
|
|
} |