slight code clean up
This commit is contained in:
parent
18891308bc
commit
2b44a39ee8
|
@ -451,7 +451,6 @@ void GameState::cleanupBoard(bool emitChanges) {
|
||||||
QString GameState::generateStateHash() const {
|
QString GameState::generateStateHash() const {
|
||||||
QString stateHash;
|
QString stateHash;
|
||||||
|
|
||||||
// The repetition here is annoying, I know
|
|
||||||
for (const auto& column : m_columns) {
|
for (const auto& column : m_columns) {
|
||||||
for (const ColumnSlot* slot : column) {
|
for (const ColumnSlot* slot : column) {
|
||||||
stateHash += QString::number(slot->card()->value()) + "." + QString::number(slot->card()->suit());
|
stateHash += QString::number(slot->card()->value()) + "." + QString::number(slot->card()->suit());
|
||||||
|
@ -592,10 +591,8 @@ bool GameState::isColumnMoveValid(const PlayingCard& cardToMove, int columnId) c
|
||||||
const PlayingCard& columnCard = *columnStack.last()->card();
|
const PlayingCard& columnCard = *columnStack.last()->card();
|
||||||
|
|
||||||
// The card's value must be one less than the card in the column
|
// The card's value must be one less than the card in the column
|
||||||
if (cardToMove.value() != columnCard.value() - 1) {
|
if (cardToMove.value() != static_cast<PlayingCard::Value>(static_cast<int>(columnCard.value() - 1)))
|
||||||
qDebug() << "* Move attempt failed (wrong value)";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// The card must be of opposite color
|
// The card must be of opposite color
|
||||||
return PlayingCard::areOppositeColors(cardToMove, columnCard);
|
return PlayingCard::areOppositeColors(cardToMove, columnCard);
|
||||||
|
|
Loading…
Reference in a new issue