bugfix: correctly revert manual cases even when rotate_next_draw was used
This commit is contained in:
parent
b9b73406f2
commit
ab31588dbb
1 changed files with 12 additions and 4 deletions
|
@ -386,10 +386,18 @@ namespace Hanabi {
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (!_draw_pile.empty() and _draw_pile.front().card.suit == drawn.suit and
|
// We don't know where the card came from (between the card having been removed from the draw pile
|
||||||
_draw_pile.front().card.rank == drawn.rank) {
|
// and re-adding it now, the user may have arbitrarily permuted the draw pile implicitly)
|
||||||
_draw_pile.front().multiplicity++;
|
// so we have to check if it is already contained in the draw pile somewhere
|
||||||
} else {
|
auto it = std::find_if(_draw_pile.begin(), _draw_pile.end(), [&drawn](CardMultiplicity const & mult){
|
||||||
|
return mult.card == drawn;
|
||||||
|
});
|
||||||
|
if (it != _draw_pile.end())
|
||||||
|
{
|
||||||
|
it->multiplicity++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_draw_pile.push_front({drawn, 1});
|
_draw_pile.push_front({drawn, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue