mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 08:52:19 -07:00
Removed unnecessary check to prevent cards from moving to the same position
This commit is contained in:
parent
f28ceca1de
commit
b688405af3
2 changed files with 0 additions and 14 deletions
|
|
@ -105,15 +105,8 @@ void CommandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &cards = getLogic()->getCards();
|
|
||||||
int index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
|
int index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
|
||||||
|
|
||||||
// Same-zone no-op: don't move a card onto itself (index may equal size for append)
|
|
||||||
if (startZone == getLogic() && !cards.isEmpty() &&
|
|
||||||
cards.at(qMin(index, static_cast<int>(cards.size()) - 1))->getId() == dragItems.at(0)->getId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_player_id(startZone->getPlayer()->getPlayerInfo()->getId());
|
cmd.set_start_player_id(startZone->getPlayer()->getPlayerInfo()->getId());
|
||||||
cmd.set_start_zone(startZone->getName().toStdString());
|
cmd.set_start_zone(startZone->getName().toStdString());
|
||||||
|
|
|
||||||
|
|
@ -47,15 +47,8 @@ void StackZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &cards = getLogic()->getCards();
|
|
||||||
int index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
|
int index = calcDropIndexFromY(dropPoint.y(), MIN_CARD_VISIBLE);
|
||||||
|
|
||||||
// Same-zone no-op: don't move a card onto itself (index may equal size for append)
|
|
||||||
if (startZone == getLogic() && !cards.isEmpty() &&
|
|
||||||
cards.at(qMin(index, static_cast<int>(cards.size()) - 1))->getId() == dragItems.at(0)->getId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_player_id(startZone->getPlayer()->getPlayerInfo()->getId());
|
cmd.set_start_player_id(startZone->getPlayer()->getPlayerInfo()->getId());
|
||||||
cmd.set_start_zone(startZone->getName().toStdString());
|
cmd.set_start_zone(startZone->getName().toStdString());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue