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;
|
_card_positions[_hands[_turn][index]] = draw_pile;
|
||||||
|
|
||||||
// draw a new card if the draw pile is not empty
|
// put card back into draw pile (at the back)
|
||||||
if (_draw_pile.back().card == _hands[_turn][index]) {
|
if (!_draw_pile.empty() and _draw_pile.back().card == _hands[_turn][index]) {
|
||||||
_draw_pile.back().multiplicity++;
|
_draw_pile.back().multiplicity++;
|
||||||
} else {
|
} else {
|
||||||
_draw_pile.push_back({_hands[_turn][index], 1});
|
_draw_pile.push_back({_hands[_turn][index], 1});
|
||||||
|
Loading…
Reference in New Issue
Block a user