Nuked PokerGame file

This commit is contained in:
2021-05-17 06:32:10 -07:00
parent 9af4115bad
commit c854ebbb5d
18 changed files with 82 additions and 163 deletions

View File

@ -7,7 +7,7 @@
#include "action.h"
void holdemActionInit() {
void pokerActionInit() {
// Free up all actions
memset(POKER_STATE.actionQueue, (int32_t)NULL,
sizeof(pokeraction_t) * POKER_ACTION_QUEUE_SIZE
@ -19,7 +19,7 @@ void holdemActionInit() {
);
}
int32_t holdemActionAdd(pokeraction_t action) {
int32_t pokerActionAdd(pokeraction_t action) {
int32_t i = -1;
int32_t j = -1;
@ -35,7 +35,7 @@ int32_t holdemActionAdd(pokeraction_t action) {
return j;
}
void holdemActionRemove(int32_t index) {
void pokerActionRemove(int32_t index) {
if(POKER_STATE.actionQueue[index].dispose != NULL) {
POKER_STATE.actionQueue[index].dispose(
index, POKER_STATE.actionData + index
@ -51,7 +51,7 @@ void holdemActionRemove(int32_t index) {
);
}
void holdemActionUpdate() {
void pokerActionUpdate() {
int32_t i;
void **data;
pokeraction_t *action;
@ -71,7 +71,7 @@ void holdemActionUpdate() {
}
}
void holdemActionDispose() {
void pokerActionDispose() {
int32_t i;
for(i = 0; i < POKER_ACTION_QUEUE_SIZE; i++) {
if(POKER_STATE.actionQueue[i].dispose == NULL) continue;

View File

@ -11,7 +11,7 @@
/**
* Initializes the action manager.
*/
void holdemActionInit();
void pokerActionInit();
/**
* Adds an action to the action queue.
@ -19,22 +19,22 @@ void holdemActionInit();
* @param action Action to add to the queue.
* @returns The index of the action within the queue, or -1 if failure occured.
*/
int32_t holdemActionAdd(pokeraction_t action);
int32_t pokerActionAdd(pokeraction_t action);
/**
* Removes an action from the action queue.
*
* @param index Action to remove (by index in the queue).
*/
void holdemActionRemove(int32_t index);
void pokerActionRemove(int32_t index);
/**
* Updates the action manager, which (in turn) updates all actions that are
* currently running.
*/
void holdemActionUpdate();
void pokerActionUpdate();
/**
* Cleans up the action manager and all actions.
*/
void holdemActionDispose();
void pokerActionDispose();

View File

@ -25,7 +25,7 @@ void actionAiInit(int32_t index, void *data) {
worth the risk. I may need history of the game to make informed decision
*/
holdemActionRemove(index);
pokerActionRemove(index);
}
void actionAiUpdate(int32_t index, void *data) {
@ -34,6 +34,6 @@ void actionAiUpdate(int32_t index, void *data) {
void actionAiDispose(int32_t index, void *data) {
// Do we need to do a flop?
if(POKER_STATE.cardsFacing < HOLDEM_DEALER_HAND) {
holdemActionAdd(actionFlop());
pokerActionAdd(actionFlop());
}
}

View File

@ -33,7 +33,7 @@ void actionDealInit(int32_t index, void *data) {
}
}
holdemActionRemove(index);
pokerActionRemove(index);
}
void actionDealUpdate(int32_t i, void *data) {
@ -41,5 +41,5 @@ void actionDealUpdate(int32_t i, void *data) {
}
void actionDealDispose(int32_t i, void *data) {
int32_t newI = holdemActionAdd(actionAi());
int32_t newI = pokerActionAdd(actionAi());
}

View File

@ -39,7 +39,7 @@ void actionFlopInit(int32_t index, void *data) {
}
// Next action
holdemActionRemove(index);
pokerActionRemove(index);
}
void actionFlopUpdate(int32_t index, void *data) {
@ -47,5 +47,5 @@ void actionFlopUpdate(int32_t index, void *data) {
}
void actionFlopDispose(int32_t index, void *data) {
holdemActionAdd(actionAi());
pokerActionAdd(actionAi());
}

View File

@ -45,7 +45,7 @@ void actionRoundInit(int32_t index, void *data) {
}
// Next action
holdemActionRemove(index);
pokerActionRemove(index);
}
void actionRoundUpdate(int32_t index, void *data) {
@ -53,11 +53,11 @@ void actionRoundUpdate(int32_t index, void *data) {
void actionRoundAfterShuffle() {
logText("Shuffle Done");
int32_t i = holdemActionAdd(actionDeal());
int32_t i = pokerActionAdd(actionDeal());
}
void actionRoundDispose(int32_t index, void *data) {
int32_t newI = holdemActionAdd(actionShuffle());
int32_t newI = pokerActionAdd(actionShuffle());
shuffledata_t *newData=(shuffledata_t *)(POKER_STATE.actionData + newI);
newData->done = &actionRoundAfterShuffle;
}

View File

@ -18,7 +18,7 @@ pokeraction_t actionShuffle() {
void actionShuffleInit(int32_t index, void *data) {
logText("Shuffle Deck");
cardShuffle(POKER_STATE.deck, POKER_STATE.deckSize);
holdemActionRemove(index);
pokerActionRemove(index);
}
void actionShuffleUpdate(int32_t index, void *data) {

View File

@ -34,7 +34,7 @@ void actionStartInit(int32_t index, void *data) {
player->chips = 0;
}
holdemActionRemove(index);
pokerActionRemove(index);
}
void actionStartUpdate(int32_t index, void *data) {
@ -42,5 +42,5 @@ void actionStartUpdate(int32_t index, void *data) {
void actionStartDispose(int32_t index, void *data) {
// Begin the first round
holdemActionAdd(actionRound());
pokerActionAdd(actionRound());
}