check for emptiness of draw pile when reverting turn
This commit is contained in:
parent
2a311bb736
commit
babc3f5085
2 changed files with 3 additions and 3 deletions
|
@ -144,8 +144,8 @@ namespace Hanabi {
|
|||
|
||||
_card_positions[_hands[_turn][index]] = draw_pile;
|
||||
|
||||
// draw a new card if the draw pile is not empty
|
||||
if (_draw_pile.back().card == _hands[_turn][index]) {
|
||||
// put card back into draw pile (at the back)
|
||||
if (!_draw_pile.empty() and _draw_pile.back().card == _hands[_turn][index]) {
|
||||
_draw_pile.back().multiplicity++;
|
||||
} else {
|
||||
_draw_pile.push_back({_hands[_turn][index], 1});
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -54,7 +54,7 @@ void print_sizes() {
|
|||
}
|
||||
|
||||
int main() {
|
||||
// Hanabi::test_game();
|
||||
Hanabi::test_game();
|
||||
Hanabi::download();
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue