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; return false;
} }
// We'll be moving the top card in the column (maybe) // We'll be moving the last card in the column (maybe)
PlayingCard *cardToMove = m_columns[columnId].first()->card(); PlayingCard *cardToMove = m_columns[columnId].last()->card();
// Try moving the card into the foundation // Try moving the card into the foundation
if (!tryMoveCardToFoundation(foundationId, cardToMove)) 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, // We succeeded, the card is now in the appropriate foundation pile,
// let's remove the column slot. // let's remove the column slot.
m_columns[columnId].removeFirst(); m_columns[columnId].removeLast();
ensureColumnRevealed(columnId); ensureColumnRevealed(columnId);
emit columnsChanged(); emit columnsChanged();
@ -186,15 +186,15 @@ bool GameState::autoMoveColumnCard(int columnId)
return false; return false;
} }
// We'll be moving the top card in the column (maybe) // We'll be moving the last card in the column (maybe)
PlayingCard *cardToMove = m_columns[columnId].first()->card(); PlayingCard *cardToMove = m_columns[columnId].last()->card();
if (!tryAutoMoveCard(cardToMove)) if (!tryAutoMoveCard(cardToMove))
return false; return false;
// We succeeded, the card is now in the appropriate foundation pile, // We succeeded, the card is now in the appropriate foundation pile,
// let's remove the column slot. // let's remove the column slot.
m_columns[columnId].removeFirst(); m_columns[columnId].removeLast();
ensureColumnRevealed(columnId); ensureColumnRevealed(columnId);
emit columnsChanged(); emit columnsChanged();
@ -300,8 +300,8 @@ void GameState::ensureColumnRevealed(int columnId)
if (m_columns[columnId].isEmpty()) if (m_columns[columnId].isEmpty())
return; return;
// Get the top column slot // Get the last column slot
ColumnSlot *col = m_columns[columnId].first(); ColumnSlot *col = m_columns[columnId].last();
// If it's already revealed, there's nothing to do // If it's already revealed, there's nothing to do
if (col->isRevealed()) if (col->isRevealed())