bug: fix manual cross-column movement logic

The original implementation didn't use references for the QList
instances, which meant they were getting copied, so the changes made
didn't mutate the actual values held by the class.
This commit is contained in:
ItsDrike 2024-12-06 17:08:32 +01:00
parent 5240949353
commit 18891308bc
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -184,8 +184,8 @@ bool GameState::moveThrownCardToFoundation(int foundationId) {
bool GameState::moveColumnCardToColumn(int fromColumnId, int toColumnId, int fromCardIndex) { bool GameState::moveColumnCardToColumn(int fromColumnId, int toColumnId, int fromCardIndex) {
assert(fromColumnId >= 0 && fromColumnId < 7); assert(fromColumnId >= 0 && fromColumnId < 7);
assert(toColumnId >= 0 && toColumnId < 7); assert(toColumnId >= 0 && toColumnId < 7);
auto fromColumnStack = m_columns[fromColumnId]; auto& fromColumnStack = m_columns[fromColumnId];
auto toColumnStack = m_columns[toColumnId]; auto& toColumnStack = m_columns[toColumnId];
if (fromColumnStack.isEmpty()) { if (fromColumnStack.isEmpty()) {
qWarning() << "Attempted to move card(s) to column from an empty column"; qWarning() << "Attempted to move card(s) to column from an empty column";