From 629676428f36bca970740a61106e08fb4a3761b1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 3 Dec 2024 02:15:49 +0100 Subject: [PATCH] Fix some bugs in gamestate --- gamestate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gamestate.cpp b/gamestate.cpp index df8d25d..8b4b7aa 100644 --- a/gamestate.cpp +++ b/gamestate.cpp @@ -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;