[Game] Fix dragged card always placed on bottom of stack

This commit is contained in:
RickyRister 2026-08-30 20:28:14 -07:00
parent 68e4fa054d
commit f0250c772a

View file

@ -58,17 +58,12 @@ void StackZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
} }
const auto &cards = getLogic()->getCards(); const auto &cards = getLogic()->getCards();
int index; int index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
if (startZone == getLogic()) { if (startZone == getLogic()) {
// Reordering within the zone: use drop position
index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
// Same-zone no-op: don't move a card onto itself // Same-zone no-op: don't move a card onto itself
if (!cards.isEmpty() && cards.at(index)->getId() == dragItems.at(0)->getId()) { if (!cards.isEmpty() && cards.at(index)->getId() == dragItems.at(0)->getId()) {
return; return;
} }
} else {
// Coming from another zone: append at end (top of stack, rendered on top)
index = static_cast<int>(cards.size());
} }
Command_MoveCard cmd; Command_MoveCard cmd;