Return bool (success status) from drawNextCard
This commit is contained in:
parent
206ff25a1a
commit
eec98ba110
|
@ -89,14 +89,14 @@ void GameState::setupWinningDeck() {
|
||||||
emit foundationChanged();
|
emit foundationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::drawNextCard() {
|
bool GameState::drawNextCard() {
|
||||||
qDebug() << "Drawing next card.";
|
qDebug() << "Drawing next card.";
|
||||||
|
|
||||||
// If drawPile is empty, flip the throwawayPile to drawPile
|
// If drawPile is empty, flip the throwawayPile to drawPile
|
||||||
if (m_drawPile.isEmpty()) {
|
if (m_drawPile.isEmpty()) {
|
||||||
if (m_throwawayPile.isEmpty()) {
|
if (m_throwawayPile.isEmpty()) {
|
||||||
qWarning() << "Drawing a card failed, no more cards to draw from";
|
qWarning() << "Drawing a card failed, no more cards to draw from";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
m_drawPile = m_throwawayPile;
|
m_drawPile = m_throwawayPile;
|
||||||
m_throwawayPile.clear();
|
m_throwawayPile.clear();
|
||||||
|
@ -110,6 +110,7 @@ void GameState::drawNextCard() {
|
||||||
|
|
||||||
emit drawPileChanged();
|
emit drawPileChanged();
|
||||||
emit throwawayPileChanged();
|
emit throwawayPileChanged();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::moveThrownCardToColumn(int columnId) {
|
bool GameState::moveThrownCardToColumn(int columnId) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GameState : public QObject {
|
||||||
// General functions
|
// General functions
|
||||||
Q_INVOKABLE void dealCards();
|
Q_INVOKABLE void dealCards();
|
||||||
Q_INVOKABLE void setupWinningDeck();
|
Q_INVOKABLE void setupWinningDeck();
|
||||||
Q_INVOKABLE void drawNextCard();
|
Q_INVOKABLE bool drawNextCard();
|
||||||
|
|
||||||
// Manual moves (from X to Y)
|
// Manual moves (from X to Y)
|
||||||
Q_INVOKABLE bool moveThrownCardToColumn(int columnId);
|
Q_INVOKABLE bool moveThrownCardToColumn(int columnId);
|
||||||
|
|
Loading…
Reference in a new issue