Const correctness for valid move checks
This commit is contained in:
parent
4692ce356b
commit
03e74a6c67
|
@ -455,7 +455,7 @@ bool GameState::tryAutoMoveMultipleCards(const QList<PlayingCard*>& cards, int s
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::isFoundationMoveValid(const PlayingCard& cardToMove, int foundationId) {
|
bool GameState::isFoundationMoveValid(const PlayingCard& cardToMove, int foundationId) const {
|
||||||
assert(foundationId >= 0 && foundationId < 4);
|
assert(foundationId >= 0 && foundationId < 4);
|
||||||
const auto foundationSuit = static_cast<PlayingCard::Suit>(foundationId);
|
const auto foundationSuit = static_cast<PlayingCard::Suit>(foundationId);
|
||||||
const auto& foundationStack = m_foundation[foundationId];
|
const auto& foundationStack = m_foundation[foundationId];
|
||||||
|
@ -484,7 +484,7 @@ bool GameState::isFoundationMoveValid(const PlayingCard& cardToMove, int foundat
|
||||||
return cardToMove.value() == requiredValue;
|
return cardToMove.value() == requiredValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::isColumnMoveValid(const PlayingCard& cardToMove, int columnId) {
|
bool GameState::isColumnMoveValid(const PlayingCard& cardToMove, int columnId) const {
|
||||||
assert(columnId >= 0 && columnId < 7);
|
assert(columnId >= 0 && columnId < 7);
|
||||||
const auto& columnStack = m_columns[columnId];
|
const auto& columnStack = m_columns[columnId];
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,8 @@ class GameState : public QObject {
|
||||||
bool tryAutoMoveSingleCard(PlayingCard& cardToMove, int skipColumnId = -1);
|
bool tryAutoMoveSingleCard(PlayingCard& cardToMove, int skipColumnId = -1);
|
||||||
bool tryAutoMoveMultipleCards(const QList<PlayingCard*>& cards, int skipColumnId);
|
bool tryAutoMoveMultipleCards(const QList<PlayingCard*>& cards, int skipColumnId);
|
||||||
|
|
||||||
bool isFoundationMoveValid(const PlayingCard& cardToMove, int foundationId);
|
bool isFoundationMoveValid(const PlayingCard& cardToMove, int foundationId) const;
|
||||||
bool isColumnMoveValid(const PlayingCard& cardToMove, int columnId);
|
bool isColumnMoveValid(const PlayingCard& cardToMove, int columnId) const;
|
||||||
|
|
||||||
void ensureColumnRevealed(int columnId);
|
void ensureColumnRevealed(int columnId);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue