[Player] Rename player to player logic (#6913)

Took 13 minutes

Took 6 seconds

Took 2 minutes

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-05-19 12:36:31 +02:00 committed by GitHub
parent 71790d8e10
commit 5219cffa6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
79 changed files with 397 additions and 386 deletions

View file

@ -13,7 +13,7 @@
#include <libcockatrice/card/database/card_database.h>
#include <libcockatrice/card/database/card_database_manager.h>
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, Player *_owner, int _id)
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, PlayerLogic *_owner, int _id)
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),
bgColor(Qt::transparent), isHovered(false), realZValue(0)
{

View file

@ -14,7 +14,7 @@
#include <libcockatrice/card/printing/exact_card.h>
#include <libcockatrice/utility/card_ref.h>
class Player;
class PlayerLogic;
class AbstractCardItem : public ArrowTarget
{
@ -56,7 +56,7 @@ public:
}
explicit AbstractCardItem(QGraphicsItem *parent = nullptr,
const CardRef &cardRef = {},
Player *_owner = nullptr,
PlayerLogic *_owner = nullptr,
int _id = -1);
~AbstractCardItem() override;
QRectF boundingRect() const override;

View file

@ -2,8 +2,8 @@
#include "../../client/settings/cache_settings.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../player/player.h"
#include "../player/player_actions.h"
#include "../player/player_logic.h"
#include "translate_counter_name.h"
#include <QAction>
@ -16,7 +16,7 @@
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
#include <libcockatrice/utility/expression.h>
AbstractCounter::AbstractCounter(Player *_player,
AbstractCounter::AbstractCounter(PlayerLogic *_player,
int _id,
const QString &_name,
bool _shownInCounterArea,

View file

@ -13,7 +13,7 @@
#include <QGraphicsItem>
#include <QInputDialog>
class Player;
class PlayerLogic;
class QAction;
class QKeyEvent;
class QMenu;
@ -25,7 +25,7 @@ class AbstractCounter : public QObject, public QGraphicsItem, public AbstractPla
Q_INTERFACES(QGraphicsItem)
protected:
Player *player;
PlayerLogic *player;
int id;
QString name;
int value;
@ -48,7 +48,7 @@ private slots:
void setCounter();
public:
AbstractCounter(Player *_player,
AbstractCounter(PlayerLogic *_player,
int _id,
const QString &_name,
bool _shownInCounterArea,

View file

@ -3,8 +3,8 @@
#include "../../client/settings/cache_settings.h"
#include "../../game_graphics/zones/card_zone.h"
#include "../player/player.h"
#include "../player/player_actions.h"
#include "../player/player_logic.h"
#include "../player/player_target.h"
#include "../z_values.h"
#include "card_item.h"
@ -21,7 +21,11 @@
#include <libcockatrice/utility/color.h>
#include <libcockatrice/utility/zone_names.h>
ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &_color)
ArrowItem::ArrowItem(PlayerLogic *_player,
int _id,
ArrowTarget *_startItem,
ArrowTarget *_targetItem,
const QColor &_color)
: QGraphicsItem(), player(_player), id(_id), startItem(_startItem), targetItem(_targetItem), targetLocked(false),
color(_color), fullColor(true)
{
@ -160,7 +164,7 @@ void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
ArrowDragItem::ArrowDragItem(PlayerLogic *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase)
: ArrowItem(_owner, -1, _startItem, 0, _color), deleteInPhase(_deleteInPhase)
{
}

View file

@ -12,7 +12,7 @@
class CardItem;
class QGraphicsSceneMouseEvent;
class QMenu;
class Player;
class PlayerLogic;
class ArrowTarget;
class ArrowItem : public QObject, public QGraphicsItem
@ -24,7 +24,7 @@ private:
QMenu *menu;
protected:
Player *player;
PlayerLogic *player;
int id;
ArrowTarget *startItem, *targetItem;
bool targetLocked;
@ -33,7 +33,7 @@ protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
public:
ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color);
ArrowItem(PlayerLogic *_player, int _id, ArrowTarget *_startItem, ArrowTarget *_targetItem, const QColor &color);
~ArrowItem() override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
[[nodiscard]] QRectF boundingRect() const override
@ -51,7 +51,7 @@ public:
{
return id;
}
[[nodiscard]] Player *getPlayer() const
[[nodiscard]] PlayerLogic *getPlayer() const
{
return player;
}
@ -86,7 +86,7 @@ private:
QList<ArrowDragItem *> childArrows;
public:
ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
ArrowDragItem(PlayerLogic *_owner, ArrowTarget *_startItem, const QColor &_color, int _deleteInPhase);
void addChildArrow(ArrowDragItem *childArrow);
protected:

View file

@ -1,9 +1,9 @@
#include "arrow_target.h"
#include "../player/player.h"
#include "../player/player_logic.h"
#include "arrow_item.h"
ArrowTarget::ArrowTarget(Player *_owner, QGraphicsItem *parent)
ArrowTarget::ArrowTarget(PlayerLogic *_owner, QGraphicsItem *parent)
: AbstractGraphicsItem(parent), owner(_owner), beingPointedAt(false)
{
setFlag(ItemSendsScenePositionChanges);

View file

@ -11,24 +11,24 @@
#include <QList>
class Player;
class PlayerLogic;
class ArrowItem;
class ArrowTarget : public AbstractGraphicsItem
{
Q_OBJECT
protected:
Player *owner;
PlayerLogic *owner;
private:
bool beingPointedAt;
QList<ArrowItem *> arrowsFrom, arrowsTo;
public:
explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
explicit ArrowTarget(PlayerLogic *_owner, QGraphicsItem *parent = nullptr);
~ArrowTarget() override;
[[nodiscard]] Player *getOwner() const
[[nodiscard]] PlayerLogic *getOwner() const
{
return owner;
}

View file

@ -6,8 +6,8 @@
#include "../../interface/widgets/tabs/tab_game.h"
#include "../game_scene.h"
#include "../phase.h"
#include "../player/player.h"
#include "../player/player_actions.h"
#include "../player/player_logic.h"
#include "../zones/view_zone_logic.h"
#include "arrow_item.h"
#include "card_drag_item.h"
@ -20,7 +20,11 @@
#include <libcockatrice/card/card_info.h>
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
CardItem::CardItem(Player *_owner, QGraphicsItem *parent, const CardRef &cardRef, int _cardid, CardZoneLogic *_zone)
CardItem::CardItem(PlayerLogic *_owner,
QGraphicsItem *parent,
const CardRef &cardRef,
int _cardid,
CardZoneLogic *_zone)
: AbstractCardItem(parent, cardRef, _owner, _cardid), state(new CardState(this, _zone)), dragItem(nullptr)
{
owner->addCard(this);
@ -273,7 +277,7 @@ void CardItem::drawArrow(const QColor &arrowColor)
}
auto *game = owner->getGame();
Player *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
PlayerLogic *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
int phase = 0; // 0 means to not set the phase
if (SettingsCache::instance().getDoNotDeleteArrowsInSubPhases()) {
int currentPhase = game->getGameState()->getCurrentPhase();

View file

@ -17,7 +17,7 @@ class CardDatabase;
class CardDragItem;
class CardZone;
class ServerInfo_Card;
class Player;
class PlayerLogic;
class QAction;
class QColor;
@ -48,7 +48,7 @@ public:
{
return Type;
}
explicit CardItem(Player *_owner,
explicit CardItem(PlayerLogic *_owner,
QGraphicsItem *parent = nullptr,
const CardRef &cardRef = {},
int _cardid = -1,
@ -73,11 +73,11 @@ public:
{
return gridPoint;
}
[[nodiscard]] Player *getOwner() const
[[nodiscard]] PlayerLogic *getOwner() const
{
return owner;
}
void setOwner(Player *_owner)
void setOwner(PlayerLogic *_owner)
{
owner = _owner;
}

View file

@ -5,7 +5,7 @@
#include <QPainter>
GeneralCounter::GeneralCounter(Player *_player,
GeneralCounter::GeneralCounter(PlayerLogic *_player,
int _id,
const QString &_name,
const QColor &_color,

View file

@ -17,7 +17,7 @@ private:
int radius;
public:
GeneralCounter(Player *_player,
GeneralCounter(PlayerLogic *_player,
int _id,
const QString &_name,
const QColor &_color,