Clean up GameState constructor

This commit is contained in:
ItsDrike 2024-12-07 12:34:11 +01:00
parent fdc3405366
commit 3ab8cfb7dc
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -1,19 +1,15 @@
#include "gamestate.h" #include "gamestate.h"
#include <QDebug> #include <QDebug>
#include <QSet> #include <QSet>
#include <qlist.h>
#include <qqmllist.h> #include <qqmllist.h>
#include <random> #include <random>
GameState::GameState(QObject* parent, bool preDealCards) : QObject{parent} { GameState::GameState(QObject* parent, bool preDealCards) : QObject{parent}, m_columns(7), m_foundation(4), m_gameWon(false) {
assert(connect(this, &GameState::foundationChanged, this, &GameState::onFoundationChanged)); assert(connect(this, &GameState::foundationChanged, this, &GameState::onFoundationChanged));
m_foundation.resize(4); if (preDealCards)
m_columns.resize(7);
m_gameWon = false;
if (preDealCards) {
dealCards(); dealCards();
}
} }
GameState::~GameState() { GameState::~GameState() {