Fix some bugs in gamestate

This commit is contained in:
ItsDrike 2024-12-03 02:15:49 +01:00
parent 69c3b43834
commit 629676428f
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -45,8 +45,9 @@ void GameState::dealCards()
m_drawPile = deck.mid(index);
// Reset the foundation & throwaway pile
m_foundation.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
// auto-checked from onFoundationChanged, which the emits trigger
@ -224,7 +225,7 @@ void GameState::onFoundationChanged()
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)
return false;