diff --git a/src/gamestate.cpp b/src/gamestate.cpp index a6229fa..71640fe 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp @@ -89,14 +89,14 @@ void GameState::setupWinningDeck() { emit foundationChanged(); } -void GameState::drawNextCard() { +bool GameState::drawNextCard() { qDebug() << "Drawing next card."; // If drawPile is empty, flip the throwawayPile to drawPile if (m_drawPile.isEmpty()) { if (m_throwawayPile.isEmpty()) { qWarning() << "Drawing a card failed, no more cards to draw from"; - return; + return false; } m_drawPile = m_throwawayPile; m_throwawayPile.clear(); @@ -110,6 +110,7 @@ void GameState::drawNextCard() { emit drawPileChanged(); emit throwawayPileChanged(); + return true; } bool GameState::moveThrownCardToColumn(int columnId) { diff --git a/src/gamestate.h b/src/gamestate.h index e44df58..04d5f1d 100644 --- a/src/gamestate.h +++ b/src/gamestate.h @@ -30,7 +30,7 @@ class GameState : public QObject { // General functions Q_INVOKABLE void dealCards(); Q_INVOKABLE void setupWinningDeck(); - Q_INVOKABLE void drawNextCard(); + Q_INVOKABLE bool drawNextCard(); // Manual moves (from X to Y) Q_INVOKABLE bool moveThrownCardToColumn(int columnId);