Split the bet tests out.
This commit is contained in:
@ -13,6 +13,7 @@ uint8_t pokerPotAdd(poker_t *poker) {
|
||||
pot = poker->pots + i;
|
||||
pot->chips = 0;
|
||||
pot->playerCount = 0;
|
||||
pot->call = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -26,3 +27,18 @@ void pokerPotAddPlayer(pokerpot_t *pot, uint8_t playerIndex) {
|
||||
if(pokerPotHasPlayer(pot, playerIndex)) return;
|
||||
pot->players[pot->playerCount++] = playerIndex;
|
||||
}
|
||||
|
||||
int32_t pokerPotGetSumOfChipsForPlayer(poker_t *poker, uint8_t playerIndex) {
|
||||
int32_t count;
|
||||
uint8_t i;
|
||||
pokerpot_t *pot;
|
||||
|
||||
count = 0;
|
||||
for(i = 0; i < poker->potCount; i++) {
|
||||
pot = poker->pots + i;
|
||||
if(!pokerPotHasPlayer(pot, playerIndex)) continue;
|
||||
count += pot->chips;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
Reference in New Issue
Block a user