revert refactor

This commit is contained in:
RickyRister 2026-02-21 17:55:40 -08:00
parent 5a7b861827
commit 28f84e1b4f
3 changed files with 2 additions and 29 deletions

View file

@ -1,6 +1,5 @@
#include "card_zone.h"
#include "../board/card_drag_item.h"
#include "../board/card_item.h"
#include "view_zone.h"
@ -29,22 +28,6 @@ void CardZone::retranslateUi()
getLogic()->getCards()[i]->retranslateUi();
}
bool CardZone::shouldDropFaceDown(const CardDragItem *item, const CardZoneLogic *startZone) const
{
// forceFaceDown takes precedence over everything
if (item->isForceFaceDown()) {
return true;
}
// Maintain face-down state if same zone.
// Compare using zone names so card remains face-down when you hand it over to your opponent
if (startZone->getName() == getLogic()->getName()) {
return item->getItem()->getFaceDown();
}
return false;
}
void CardZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * /*event*/)
{
if (doubleClickAction)

View file

@ -67,15 +67,6 @@ public:
doubleClickAction = _doubleClickAction;
}
/**
* Checks if the dropEvent caused by the given CardDragItem should result in the face_down field of the resulting
* MoveCard command to be true.
* @param item The CardDragItem that is being dropped into this zone
* @param startZone The zone that the item came from
* @return Whether to set face_down to true
*/
bool shouldDropFaceDown(const CardDragItem *item, const CardZoneLogic *startZone) const;
private:
CardZoneLogic *logic;
};

View file

@ -134,9 +134,8 @@ void TableZone::handleDropEventByGrid(const QList<CardDragItem *> &dragItems,
for (const auto &item : dragItems) {
CardToMove *ctm = cmd.mutable_cards_to_move()->add_card();
ctm->set_card_id(item->getId());
bool faceDown = shouldDropFaceDown(item, startZone);
ctm->set_face_down(faceDown);
if (startZone->getName() != getLogic()->getName() && !faceDown) {
ctm->set_face_down(item->isForceFaceDown());
if (startZone->getName() != getLogic()->getName() && !item->isForceFaceDown()) {
const auto &card = item->getItem()->getCard();
if (card) {
ctm->set_pt(card.getInfo().getPowTough().toStdString());