From d97cccfdf0021e0baa6f1b7e11df4814fb26b98f Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 3 Dec 2024 15:13:20 +0100 Subject: [PATCH] bug: work with last column slot, not first --- gamestate.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gamestate.cpp b/gamestate.cpp index 8b4b7aa..3a19370 100644 --- a/gamestate.cpp +++ b/gamestate.cpp @@ -130,8 +130,8 @@ bool GameState::moveColumnCardToFoundation(int columnId, PlayingCard::Suit found return false; } - // We'll be moving the top card in the column (maybe) - PlayingCard *cardToMove = m_columns[columnId].first()->card(); + // We'll be moving the last card in the column (maybe) + PlayingCard *cardToMove = m_columns[columnId].last()->card(); // Try moving the card into the foundation if (!tryMoveCardToFoundation(foundationId, cardToMove)) @@ -139,7 +139,7 @@ bool GameState::moveColumnCardToFoundation(int columnId, PlayingCard::Suit found // We succeeded, the card is now in the appropriate foundation pile, // let's remove the column slot. - m_columns[columnId].removeFirst(); + m_columns[columnId].removeLast(); ensureColumnRevealed(columnId); emit columnsChanged(); @@ -186,15 +186,15 @@ bool GameState::autoMoveColumnCard(int columnId) return false; } - // We'll be moving the top card in the column (maybe) - PlayingCard *cardToMove = m_columns[columnId].first()->card(); + // We'll be moving the last card in the column (maybe) + PlayingCard *cardToMove = m_columns[columnId].last()->card(); if (!tryAutoMoveCard(cardToMove)) return false; // We succeeded, the card is now in the appropriate foundation pile, // let's remove the column slot. - m_columns[columnId].removeFirst(); + m_columns[columnId].removeLast(); ensureColumnRevealed(columnId); emit columnsChanged(); @@ -300,8 +300,8 @@ void GameState::ensureColumnRevealed(int columnId) if (m_columns[columnId].isEmpty()) return; - // Get the top column slot - ColumnSlot *col = m_columns[columnId].first(); + // Get the last column slot + ColumnSlot *col = m_columns[columnId].last(); // If it's already revealed, there's nothing to do if (col->isRevealed())