mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
Currently, zones must keep track of which cards they move in order to manually call `updatePath` on arrows. This patch sets the `ItemSendsScenePositionChanges` flag on `ArrowTarget`s to automatically update arrow positions without requiring zones to keep track of that information.
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
#ifndef ARROWTARGET_H
|
|
#define ARROWTARGET_H
|
|
|
|
#include "abstract_graphics_item.h"
|
|
|
|
#include <QList>
|
|
|
|
class Player;
|
|
class ArrowItem;
|
|
|
|
class ArrowTarget : public AbstractGraphicsItem
|
|
{
|
|
Q_OBJECT
|
|
protected:
|
|
Player *owner;
|
|
|
|
private:
|
|
bool beingPointedAt;
|
|
QList<ArrowItem *> arrowsFrom, arrowsTo;
|
|
|
|
public:
|
|
explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
|
|
~ArrowTarget() override;
|
|
|
|
Player *getOwner() const
|
|
{
|
|
return owner;
|
|
}
|
|
|
|
void setBeingPointedAt(bool _beingPointedAt);
|
|
bool getBeingPointedAt() const
|
|
{
|
|
return beingPointedAt;
|
|
}
|
|
|
|
const QList<ArrowItem *> &getArrowsFrom() const
|
|
{
|
|
return arrowsFrom;
|
|
}
|
|
void addArrowFrom(ArrowItem *arrow)
|
|
{
|
|
arrowsFrom.append(arrow);
|
|
}
|
|
void removeArrowFrom(ArrowItem *arrow)
|
|
{
|
|
arrowsFrom.removeOne(arrow);
|
|
}
|
|
const QList<ArrowItem *> &getArrowsTo() const
|
|
{
|
|
return arrowsTo;
|
|
}
|
|
void addArrowTo(ArrowItem *arrow)
|
|
{
|
|
arrowsTo.append(arrow);
|
|
}
|
|
void removeArrowTo(ArrowItem *arrow)
|
|
{
|
|
arrowsTo.removeOne(arrow);
|
|
}
|
|
|
|
protected:
|
|
QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override;
|
|
};
|
|
#endif
|