29 lines
658 B
C
29 lines
658 B
C
/**
|
|
* 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;
|
|
}
|