Return bool (success status) from drawNextCard
This commit is contained in:
parent
206ff25a1a
commit
eec98ba110
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue