check for emptiness of draw pile when reverting turn
This commit is contained in:
parent
2a311bb736
commit
babc3f5085
@ -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});
|
||||
|
Loading…
Reference in New Issue
Block a user