Refactoring structs Part 1
This commit is contained in:
45
temp/action/deal.c
Normal file
45
temp/action/deal.c
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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());
|
||||
}
|
Reference in New Issue
Block a user