|
|
|
|
|
|
|
|
// let's start by assuming the player does not need to do anything |
|
|
// let's start by assuming the player does not need to do anything |
|
|
player->actionRequired = Libreblackjack::PlayerActionRequired::None; |
|
|
player->actionRequired = Libreblackjack::PlayerActionRequired::None; |
|
|
|
|
|
|
|
|
std::list<PlayerHand>::iterator playerHand; |
|
|
|
|
|
|
|
|
// std::list<PlayerHand>::iterator playerHand; |
|
|
|
|
|
|
|
|
switch(nextAction) { |
|
|
switch(nextAction) { |
|
|
// ------------------------------------------------------------------------- |
|
|
// ------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
hand.cards.clear(); |
|
|
hand.cards.clear(); |
|
|
|
|
|
|
|
|
// erase all the player's hands, create one, add and make it the current one |
|
|
// erase all the player's hands, create one, add and make it the current one |
|
|
for (playerHand = playerInfo.hands.begin(); playerHand != playerInfo.hands.end(); ++playerHand) { |
|
|
|
|
|
|
|
|
for (auto playerHand = playerInfo.hands.begin(); playerHand != playerInfo.hands.end(); ++playerHand) { |
|
|
playerHand->cards.clear(); |
|
|
playerHand->cards.clear(); |
|
|
} |
|
|
} |
|
|
playerInfo.hands.clear(); |
|
|
playerInfo.hands.clear(); |
|
|
|
|
|
|
|
|
case Libreblackjack::DealerAction::MoveOnToNextHand: |
|
|
case Libreblackjack::DealerAction::MoveOnToNextHand: |
|
|
// see if we finished all the player's hands |
|
|
// see if we finished all the player's hands |
|
|
if (++player->currentHand != player->hands.end()) { |
|
|
if (++player->currentHand != player->hands.end()) { |
|
|
unsigned int playerCard = drawCard(&(*player->currentHand)); |
|
|
|
|
|
|
|
|
unsigned int playerCard = drawCard(&(*playerInfo.currentHand)); |
|
|
info(Libreblackjack::Info::CardPlayer, playerCard, player->currentHand->id); |
|
|
info(Libreblackjack::Info::CardPlayer, playerCard, player->currentHand->id); |
|
|
|
|
|
|
|
|
if (std::abs(player->currentHand->value()) == 21) { |
|
|
if (std::abs(player->currentHand->value()) == 21) { |