bug: work with last column slot, not first

This commit is contained in:
ItsDrike 2024-12-03 15:13:20 +01:00
parent dd19000089
commit d97cccfdf0
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -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())