Fix some bugs in gamestate
This commit is contained in:
parent
69c3b43834
commit
629676428f
|
@ -45,8 +45,9 @@ void GameState::dealCards()
|
||||||
m_drawPile = deck.mid(index);
|
m_drawPile = deck.mid(index);
|
||||||
|
|
||||||
// Reset the foundation & throwaway pile
|
// Reset the foundation & throwaway pile
|
||||||
m_foundation.clear();
|
|
||||||
m_throwawayPile.clear();
|
m_throwawayPile.clear();
|
||||||
|
for (auto &column : m_foundation)
|
||||||
|
column.clear();
|
||||||
|
|
||||||
// Note that we don't need to reset gameWon from here, as it's
|
// Note that we don't need to reset gameWon from here, as it's
|
||||||
// auto-checked from onFoundationChanged, which the emits trigger
|
// auto-checked from onFoundationChanged, which the emits trigger
|
||||||
|
@ -224,7 +225,7 @@ void GameState::onFoundationChanged()
|
||||||
|
|
||||||
bool GameState::tryMoveCardToFoundation(PlayingCard::Suit foundationId, PlayingCard* cardToMove)
|
bool GameState::tryMoveCardToFoundation(PlayingCard::Suit foundationId, PlayingCard* cardToMove)
|
||||||
{
|
{
|
||||||
assert(foundationId >= PlayingCard::Suit::Clubs && foundationId < PlayingCard::Suit::Spades);
|
assert(foundationId >= PlayingCard::Suit::Clubs && foundationId <= PlayingCard::Suit::Spades);
|
||||||
|
|
||||||
if (cardToMove->suit() != foundationId)
|
if (cardToMove->suit() != foundationId)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue