slight code clean up

This commit is contained in:
ItsDrike 2024-12-06 17:09:19 +01:00
parent 18891308bc
commit 2b44a39ee8
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -451,7 +451,6 @@ void GameState::cleanupBoard(bool emitChanges) {
QString GameState::generateStateHash() const {
QString stateHash;
// The repetition here is annoying, I know
for (const auto& column : m_columns) {
for (const ColumnSlot* slot : column) {
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();
// The card's value must be one less than the card in the column
if (cardToMove.value() != columnCard.value() - 1) {
qDebug() << "* Move attempt failed (wrong value)";
if (cardToMove.value() != static_cast<PlayingCard::Value>(static_cast<int>(columnCard.value() - 1)))
return false;
}
// The card must be of opposite color
return PlayingCard::areOppositeColors(cardToMove, columnCard);