F
This commit is contained in:
28
src/poker/pot.c
Normal file
28
src/poker/pot.c
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pot.h"
|
||||
|
||||
uint8_t pokerPotAdd(poker_t *poker) {
|
||||
pokerpot_t *pot;
|
||||
uint8_t i = poker->potCount++;
|
||||
pot = poker->pots + i;
|
||||
pot->chips = 0;
|
||||
pot->playerCount = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
bool pokerPotHasPlayer(pokerpot_t *pot, uint8_t playerIndex) {
|
||||
return arrayContains(
|
||||
sizeof(uint8_t), pot->players, pot->playerCount, &playerIndex
|
||||
);
|
||||
}
|
||||
|
||||
void pokerPotAddPlayer(pokerpot_t *pot, uint8_t playerIndex) {
|
||||
if(pokerPotHasPlayer(pot, playerIndex)) return;
|
||||
pot->players[pot->playerCount++] = playerIndex;
|
||||
}
|
Reference in New Issue
Block a user