From 18891308bc1b82f7d1e25a97b3b926a9bedee3da Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 6 Dec 2024 17:08:32 +0100 Subject: [PATCH] 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. --- src/gamestate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gamestate.cpp b/src/gamestate.cpp index 3b9b973..878b993 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp @@ -184,8 +184,8 @@ bool GameState::moveThrownCardToFoundation(int foundationId) { bool GameState::moveColumnCardToColumn(int fromColumnId, int toColumnId, int fromCardIndex) { assert(fromColumnId >= 0 && fromColumnId < 7); assert(toColumnId >= 0 && toColumnId < 7); - auto fromColumnStack = m_columns[fromColumnId]; - auto toColumnStack = m_columns[toColumnId]; + auto& fromColumnStack = m_columns[fromColumnId]; + auto& toColumnStack = m_columns[toColumnId]; if (fromColumnStack.isEmpty()) { qWarning() << "Attempted to move card(s) to column from an empty column";