mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
revert refactor
This commit is contained in:
parent
5a7b861827
commit
28f84e1b4f
3 changed files with 2 additions and 29 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
#include "card_zone.h"
|
#include "card_zone.h"
|
||||||
|
|
||||||
#include "../board/card_drag_item.h"
|
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
#include "view_zone.h"
|
#include "view_zone.h"
|
||||||
|
|
||||||
|
|
@ -29,22 +28,6 @@ void CardZone::retranslateUi()
|
||||||
getLogic()->getCards()[i]->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*/)
|
void CardZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * /*event*/)
|
||||||
{
|
{
|
||||||
if (doubleClickAction)
|
if (doubleClickAction)
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,6 @@ public:
|
||||||
doubleClickAction = _doubleClickAction;
|
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:
|
private:
|
||||||
CardZoneLogic *logic;
|
CardZoneLogic *logic;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,8 @@ void TableZone::handleDropEventByGrid(const QList<CardDragItem *> &dragItems,
|
||||||
for (const auto &item : dragItems) {
|
for (const auto &item : dragItems) {
|
||||||
CardToMove *ctm = cmd.mutable_cards_to_move()->add_card();
|
CardToMove *ctm = cmd.mutable_cards_to_move()->add_card();
|
||||||
ctm->set_card_id(item->getId());
|
ctm->set_card_id(item->getId());
|
||||||
bool faceDown = shouldDropFaceDown(item, startZone);
|
ctm->set_face_down(item->isForceFaceDown());
|
||||||
ctm->set_face_down(faceDown);
|
if (startZone->getName() != getLogic()->getName() && !item->isForceFaceDown()) {
|
||||||
if (startZone->getName() != getLogic()->getName() && !faceDown) {
|
|
||||||
const auto &card = item->getItem()->getCard();
|
const auto &card = item->getItem()->getCard();
|
||||||
if (card) {
|
if (card) {
|
||||||
ctm->set_pt(card.getInfo().getPowTough().toStdString());
|
ctm->set_pt(card.getInfo().getPowTough().toStdString());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue