[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

@ -95,13 +95,13 @@ set(cockatrice_SOURCES
src/game/player/menu/say_menu.cpp
src/game/player/menu/sideboard_menu.cpp
src/game/player/menu/utility_menu.cpp
src/game/player/player.cpp
src/game/player/player_actions.cpp
src/game/player/player_area.cpp
src/game/player/player_event_handler.cpp
src/game/player/player_graphics_item.cpp
src/game/player/player_info.cpp
src/game/player/player_list_widget.cpp
src/game/player/player_logic.cpp
src/game/player/player_manager.cpp
src/game/player/player_target.cpp
src/game/replay.cpp

View file

@ -1,7 +1,7 @@
#include "abstract_game.h"
#include "../interface/widgets/tabs/tab_game.h"
#include "player/player.h"
#include "player/player_logic.h"
AbstractGame::AbstractGame(TabGame *_tab) : QObject(_tab), tab(_tab)
{
@ -44,7 +44,7 @@ void AbstractGame::setActiveCard(CardItem *card)
CardItem *AbstractGame::getCard(int playerId, const QString &zoneName, int cardId) const
{
Player *player = playerManager->getPlayer(playerId);
PlayerLogic *player = playerManager->getPlayer(playerId);
if (!player) {
return nullptr;
}

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,

View file

@ -99,7 +99,7 @@ void GameEventHandler::processGameEventContainer(const GameEventContainer &cont,
if (cont.has_forced_by_judge()) {
auto id = cont.forced_by_judge();
Player *judgep = game->getPlayerManager()->getPlayers().value(id, nullptr);
PlayerLogic *judgep = game->getPlayerManager()->getPlayers().value(id, nullptr);
if (judgep) {
emit setContextJudgeName(judgep->getPlayerInfo()->getName());
} else if (game->getPlayerManager()->getSpectators().contains(id)) {
@ -160,7 +160,7 @@ void GameEventHandler::processGameEventContainer(const GameEventContainer &cont,
break;
default: {
Player *player = game->getPlayerManager()->getPlayers().value(playerId, 0);
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(playerId, 0);
if (!player) {
qCWarning(GameEventHandlerLog) << "unhandled game event: invalid player id";
break;
@ -261,7 +261,7 @@ void GameEventHandler::eventGameStateChanged(const Event_GameStateChanged &event
emit spectatorJoined(prop);
}
} else {
Player *player = game->getPlayerManager()->getPlayers().value(playerId, 0);
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(playerId, 0);
if (!player) {
player = game->getPlayerManager()->addPlayer(playerId, prop.user_info());
emit playerJoined(prop);
@ -310,7 +310,7 @@ void GameEventHandler::processCardAttachmentsForPlayers(const Event_GameStateCha
const ServerInfo_Player &playerInfo = event.player_list(i);
const ServerInfo_PlayerProperties &prop = playerInfo.properties();
if (!prop.spectator()) {
Player *player = game->getPlayerManager()->getPlayers().value(prop.player_id(), 0);
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(prop.player_id(), 0);
if (!player) {
continue;
}
@ -323,7 +323,7 @@ void GameEventHandler::eventPlayerPropertiesChanged(const Event_PlayerProperties
int eventPlayerId,
const GameEventContext &context)
{
Player *player = game->getPlayerManager()->getPlayers().value(eventPlayerId, 0);
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(eventPlayerId, 0);
if (!player) {
return;
}
@ -347,7 +347,7 @@ void GameEventHandler::eventPlayerPropertiesChanged(const Event_PlayerProperties
case GameEventContext::CONCEDE: {
player->setConceded(true);
QMapIterator<int, Player *> playerIterator(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> playerIterator(game->getPlayerManager()->getPlayers());
while (playerIterator.hasNext()) {
playerIterator.next().value()->updateZones();
}
@ -359,7 +359,7 @@ void GameEventHandler::eventPlayerPropertiesChanged(const Event_PlayerProperties
case GameEventContext::UNCONCEDE: {
player->setConceded(false);
QMapIterator<int, Player *> playerIterator(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> playerIterator(game->getPlayerManager()->getPlayers());
while (playerIterator.hasNext()) {
playerIterator.next().value()->updateZones();
}
@ -409,7 +409,7 @@ void GameEventHandler::eventJoin(const Event_Join &event, int /*eventPlayerId*/,
emit logJoinSpectator(playerName);
emit spectatorJoined(playerInfo);
} else {
Player *newPlayer = game->getPlayerManager()->addPlayer(playerId, playerInfo.user_info());
PlayerLogic *newPlayer = game->getPlayerManager()->addPlayer(playerId, playerInfo.user_info());
emit logJoinPlayer(newPlayer);
emit playerJoined(playerInfo);
}
@ -437,7 +437,7 @@ QString GameEventHandler::getLeaveReason(Event_Leave::LeaveReason reason)
}
void GameEventHandler::eventLeave(const Event_Leave &event, int eventPlayerId, const GameEventContext & /*context*/)
{
Player *player = game->getPlayerManager()->getPlayers().value(eventPlayerId, 0);
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(eventPlayerId, 0);
if (!player) {
return;
}
@ -452,7 +452,7 @@ void GameEventHandler::eventLeave(const Event_Leave &event, int eventPlayerId, c
player->deleteLater();
// Rearrange all remaining zones so that attachment relationship updates take place
QMapIterator<int, Player *> playerIterator(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> playerIterator(game->getPlayerManager()->getPlayers());
while (playerIterator.hasNext()) {
playerIterator.next().value()->updateZones();
}
@ -474,7 +474,7 @@ void GameEventHandler::eventReverseTurn(const Event_ReverseTurn &event,
int eventPlayerId,
const GameEventContext & /*context*/)
{
Player *player = game->getPlayerManager()->getPlayers().value(eventPlayerId, 0);
PlayerLogic *player = game->getPlayerManager()->getPlayers().value(eventPlayerId, 0);
if (!player) {
return;
}
@ -505,7 +505,7 @@ void GameEventHandler::eventSetActivePlayer(const Event_SetActivePlayer &event,
const GameEventContext & /*context*/)
{
game->getGameState()->setActivePlayer(event.active_player_id());
Player *player = game->getPlayerManager()->getPlayer(event.active_player_id());
PlayerLogic *player = game->getPlayerManager()->getPlayer(event.active_player_id());
if (!player) {
return;
}

View file

@ -38,7 +38,7 @@ class Event_Kicked;
class Event_ReverseTurn;
class AbstractGame;
class PendingCommand;
class Player;
class PlayerLogic;
inline Q_LOGGING_CATEGORY(GameEventHandlerLog, "game_event_handler");
@ -95,7 +95,7 @@ public slots:
signals:
void emitUserEvent();
void addPlayerToAutoCompleteList(QString playerName);
void localPlayerDeckSelected(Player *localPlayer, int playerId, ServerInfo_Player playerInfo);
void localPlayerDeckSelected(PlayerLogic *localPlayer, int playerId, ServerInfo_Player playerInfo);
void remotePlayerDeckSelected(QString deckList, int playerId, QString playerName);
void remotePlayersDecksSelected(QVector<QPair<int, QPair<QString, QString>>> opponentDecks);
void localPlayerSideboardLocked(int playerId, bool sideboardLocked);
@ -115,18 +115,18 @@ signals:
void logSpectatorSay(ServerInfo_User userInfo, QString message);
void logSpectatorLeave(QString name, QString reason);
void logGameStart();
void logReadyStart(Player *player);
void logNotReadyStart(Player *player);
void logDeckSelect(Player *player, QString deckHash, int sideboardSize);
void logSideboardLockSet(Player *player, bool sideboardLocked);
void logConnectionStateChanged(Player *player, bool connected);
void logReadyStart(PlayerLogic *player);
void logNotReadyStart(PlayerLogic *player);
void logDeckSelect(PlayerLogic *player, QString deckHash, int sideboardSize);
void logSideboardLockSet(PlayerLogic *player, bool sideboardLocked);
void logConnectionStateChanged(PlayerLogic *player, bool connected);
void logJoinSpectator(QString spectatorName);
void logJoinPlayer(Player *player);
void logLeave(Player *player, QString reason);
void logJoinPlayer(PlayerLogic *player);
void logLeave(PlayerLogic *player, QString reason);
void logKicked();
void logTurnReversed(Player *player, bool reversed);
void logTurnReversed(PlayerLogic *player, bool reversed);
void logGameClosed();
void logActivePlayer(Player *activePlayer);
void logActivePlayer(PlayerLogic *activePlayer);
void logActivePhaseChanged(int activePhase);
void logConcede(int playerId);
void logUnconcede(int playerId);

View file

@ -6,8 +6,8 @@
#include "../game_graphics/zones/view_zone_widget.h"
#include "board/card_item.h"
#include "phases_toolbar.h"
#include "player/player.h"
#include "player/player_graphics_item.h"
#include "player/player_logic.h"
#include <QBasicTimer>
#include <QDebug>
@ -78,7 +78,7 @@ QList<CardItem *> GameScene::selectedCards() const
*
* Connects to the player's sizeChanged signal to recompute layout on resize.
*/
void GameScene::addPlayer(Player *player)
void GameScene::addPlayer(PlayerLogic *player)
{
qCInfo(GameScenePlayerAdditionRemovalLog) << "GameScene::addPlayer name=" << player->getPlayerInfo()->getName();
@ -93,7 +93,7 @@ void GameScene::addPlayer(Player *player)
*
* Closes any zone views associated with the player and recomputes layout.
*/
void GameScene::removePlayer(Player *player)
void GameScene::removePlayer(PlayerLogic *player)
{
qCInfo(GameScenePlayerAdditionRemovalLog) << "GameScene::removePlayer name=" << player->getPlayerInfo()->getName();
@ -178,14 +178,14 @@ void GameScene::processViewSizeChange(const QSize &newSize)
*
* Used to determine rotation and layout order.
*/
QList<Player *> GameScene::collectActivePlayers(int &firstPlayerIndex) const
QList<PlayerLogic *> GameScene::collectActivePlayers(int &firstPlayerIndex) const
{
QList<Player *> activePlayers;
QList<PlayerLogic *> activePlayers;
firstPlayerIndex = 0;
bool firstPlayerFound = false;
for (auto *pgItem : players) {
Player *p = pgItem->getPlayer();
PlayerLogic *p = pgItem->getPlayer();
if (p && !p->getConceded()) {
activePlayers.append(p);
if (!firstPlayerFound && p->getPlayerInfo()->getLocal()) {
@ -205,9 +205,9 @@ QList<Player *> GameScene::collectActivePlayers(int &firstPlayerIndex) const
*
* Applies rotation offset and ensures the list wraps correctly.
*/
QList<Player *> GameScene::rotatePlayers(const QList<Player *> &activePlayers, int firstPlayerIndex) const
QList<PlayerLogic *> GameScene::rotatePlayers(const QList<PlayerLogic *> &activePlayers, int firstPlayerIndex) const
{
QList<Player *> rotated = activePlayers;
QList<PlayerLogic *> rotated = activePlayers;
if (!rotated.isEmpty()) {
int totalRotation = firstPlayerIndex + playerRotation;
while (totalRotation < 0) {
@ -238,7 +238,7 @@ int GameScene::determineColumnCount(int playerCount)
* - Position players in columns with spacing.
* - Mirror graphics for visual balance.
*/
QSizeF GameScene::computeSceneSizeAndPlayerLayout(const QList<Player *> &playersPlaying, int columns)
QSizeF GameScene::computeSceneSizeAndPlayerLayout(const QList<PlayerLogic *> &playersPlaying, int columns)
{
playersByColumn.clear();
@ -246,7 +246,7 @@ QSizeF GameScene::computeSceneSizeAndPlayerLayout(const QList<Player *> &players
qreal sceneHeight = 0, sceneWidth = -playerAreaSpacing;
QList<int> columnWidth;
QListIterator<Player *> playersIter(playersPlaying);
QListIterator<PlayerLogic *> playersIter(playersPlaying);
for (int col = 0; col < columns; ++col) {
playersByColumn.append(QList<PlayerGraphicsItem *>());
columnWidth.append(0);
@ -254,7 +254,7 @@ QSizeF GameScene::computeSceneSizeAndPlayerLayout(const QList<Player *> &players
int rowsInColumn = rows - (playersPlaying.size() % columns) * col; // Adjust rows for uneven columns
for (int j = 0; j < rowsInColumn; ++j) {
Player *player = playersIter.next();
PlayerLogic *player = playersIter.next();
if (col == 0) {
playersByColumn[col].prepend(player->getGraphicsItem());
} else {
@ -435,7 +435,7 @@ CardItem *GameScene::findTopmostCardInZone(const QList<QGraphicsItem *> &items,
* If an identical view exists, it is closed. Otherwise, a new ZoneViewWidget is created
* and positioned based on zone type.
*/
void GameScene::toggleZoneView(Player *player, const QString &zoneName, int numberCards, bool isReversed)
void GameScene::toggleZoneView(PlayerLogic *player, const QString &zoneName, int numberCards, bool isReversed)
{
for (auto &view : zoneViews) {
ZoneViewZone *temp = view->getZone();
@ -468,7 +468,7 @@ void GameScene::toggleZoneView(Player *player, const QString &zoneName, int numb
* @param cardList List of cards to show.
* @param withWritePermission Whether edits are allowed.
*/
void GameScene::addRevealedZoneView(Player *player,
void GameScene::addRevealedZoneView(PlayerLogic *player,
CardZoneLogic *zone,
const QList<const ServerInfo_Card *> &cardList,
bool withWritePermission)

View file

@ -12,7 +12,7 @@
inline Q_LOGGING_CATEGORY(GameSceneLog, "game_scene");
inline Q_LOGGING_CATEGORY(GameScenePlayerAdditionRemovalLog, "game_scene.player_addition_removal");
class Player;
class PlayerLogic;
class PlayerGraphicsItem;
class ZoneViewWidget;
class CardZone;
@ -83,13 +83,13 @@ public:
* @brief Adds a player to the scene and stores their graphics item.
* @param player Player to add.
*/
void addPlayer(Player *player);
void addPlayer(PlayerLogic *player);
/**
* @brief Removes a player from the scene.
* @param player Player to remove.
*/
void removePlayer(Player *player);
void removePlayer(PlayerLogic *player);
/**
* @brief Adjusts the global rotation offset for player layout.
@ -111,7 +111,7 @@ public:
* @param firstPlayerIndex Output index of first local player.
* @return List of active players.
*/
QList<Player *> collectActivePlayers(int &firstPlayerIndex) const;
QList<PlayerLogic *> collectActivePlayers(int &firstPlayerIndex) const;
/**
* @brief Rotates the list of players for layout.
@ -119,7 +119,7 @@ public:
* @param firstPlayerIndex Index of first local player.
* @return Rotated list.
*/
QList<Player *> rotatePlayers(const QList<Player *> &players, int firstPlayerIndex) const;
QList<PlayerLogic *> rotatePlayers(const QList<PlayerLogic *> &players, int firstPlayerIndex) const;
/**
* @brief Determines the number of columns to display players in.
@ -134,7 +134,7 @@ public:
* @param columns Number of columns to split into.
* @return Calculated scene size.
*/
QSizeF computeSceneSizeAndPlayerLayout(const QList<Player *> &playersPlaying, int columns);
QSizeF computeSceneSizeAndPlayerLayout(const QList<PlayerLogic *> &playersPlaying, int columns);
/**
* @brief Computes the minimum width for each column based on player minimum widths.
@ -177,10 +177,10 @@ public:
public slots:
/** Toggles a zone view for a player. */
void toggleZoneView(Player *player, const QString &zoneName, int numberCards, bool isReversed = false);
void toggleZoneView(PlayerLogic *player, const QString &zoneName, int numberCards, bool isReversed = false);
/** Adds a revealed zone view (for shown cards). */
void addRevealedZoneView(Player *player,
void addRevealedZoneView(PlayerLogic *player,
CardZoneLogic *zone,
const QList<const ServerInfo_Card *> &cardList,
bool withWritePermission);

View file

@ -5,7 +5,7 @@
#include "../board/card_item.h"
#include "../board/translate_counter_name.h"
#include "../phase.h"
#include "../player/player.h"
#include "../player/player_logic.h"
#include <../../client/settings/card_counter_settings.h>
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
@ -105,7 +105,7 @@ void MessageLogWidget::containerProcessingStarted(const GameEventContext &contex
}
}
void MessageLogWidget::logAlwaysRevealTopCard(Player *player, CardZoneLogic *zone, bool reveal)
void MessageLogWidget::logAlwaysRevealTopCard(PlayerLogic *player, CardZoneLogic *zone, bool reveal)
{
appendHtmlServerMessage((reveal ? tr("%1 is now keeping the top card %2 revealed.")
: tr("%1 is not revealing the top card %2 any longer."))
@ -113,7 +113,7 @@ void MessageLogWidget::logAlwaysRevealTopCard(Player *player, CardZoneLogic *zon
.arg(zone->getTranslatedName(true, CaseTopCardsOfZone)));
}
void MessageLogWidget::logAlwaysLookAtTopCard(Player *player, CardZoneLogic *zone, bool reveal)
void MessageLogWidget::logAlwaysLookAtTopCard(PlayerLogic *player, CardZoneLogic *zone, bool reveal)
{
appendHtmlServerMessage((reveal ? tr("%1 can now look at top card %2 at any time.")
: tr("%1 no longer can look at top card %2 at any time."))
@ -121,7 +121,10 @@ void MessageLogWidget::logAlwaysLookAtTopCard(Player *player, CardZoneLogic *zon
.arg(zone->getTranslatedName(true, CaseTopCardsOfZone)));
}
void MessageLogWidget::logAttachCard(Player *player, QString cardName, Player *targetPlayer, QString targetCardName)
void MessageLogWidget::logAttachCard(PlayerLogic *player,
QString cardName,
PlayerLogic *targetPlayer,
QString targetCardName)
{
appendHtmlServerMessage(tr("%1 attaches %2 to %3's %4.")
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
@ -148,7 +151,7 @@ void MessageLogWidget::logUnconcede(int playerId)
true);
}
void MessageLogWidget::logConnectionStateChanged(Player *player, bool connectionState)
void MessageLogWidget::logConnectionStateChanged(PlayerLogic *player, bool connectionState)
{
if (connectionState) {
soundEngine->playSound("player_reconnect");
@ -161,10 +164,10 @@ void MessageLogWidget::logConnectionStateChanged(Player *player, bool connection
}
}
void MessageLogWidget::logCreateArrow(Player *player,
Player *startPlayer,
void MessageLogWidget::logCreateArrow(PlayerLogic *player,
PlayerLogic *startPlayer,
QString startCard,
Player *targetPlayer,
PlayerLogic *targetPlayer,
QString targetCard,
bool playerTarget)
{
@ -220,7 +223,7 @@ void MessageLogWidget::logCreateArrow(Player *player,
}
}
void MessageLogWidget::logCreateToken(Player *player, QString cardName, QString pt, bool faceDown)
void MessageLogWidget::logCreateToken(PlayerLogic *player, QString cardName, QString pt, bool faceDown)
{
if (faceDown) {
appendHtmlServerMessage(
@ -233,7 +236,7 @@ void MessageLogWidget::logCreateToken(Player *player, QString cardName, QString
}
}
void MessageLogWidget::logDeckSelect(Player *player, QString deckHash, int sideboardSize)
void MessageLogWidget::logDeckSelect(PlayerLogic *player, QString deckHash, int sideboardSize)
{
if (sideboardSize < 0) {
appendHtmlServerMessage(
@ -246,13 +249,13 @@ void MessageLogWidget::logDeckSelect(Player *player, QString deckHash, int sideb
}
}
void MessageLogWidget::logDestroyCard(Player *player, QString cardName)
void MessageLogWidget::logDestroyCard(PlayerLogic *player, QString cardName)
{
appendHtmlServerMessage(
tr("%1 destroys %2.").arg(sanitizeHtml(player->getPlayerInfo()->getName())).arg(cardLink(std::move(cardName))));
}
void MessageLogWidget::logMoveCard(Player *player,
void MessageLogWidget::logMoveCard(PlayerLogic *player,
CardItem *card,
CardZoneLogic *startZone,
int oldX,
@ -359,7 +362,7 @@ void MessageLogWidget::logMoveCard(Player *player,
appendHtmlServerMessage(message);
}
void MessageLogWidget::logDrawCards(Player *player, int number, bool deckIsEmpty)
void MessageLogWidget::logDrawCards(PlayerLogic *player, int number, bool deckIsEmpty)
{
soundEngine->playSound("draw_card");
if (currentContext == MessageContext_Mulligan) {
@ -376,7 +379,7 @@ void MessageLogWidget::logDrawCards(Player *player, int number, bool deckIsEmpty
}
}
void MessageLogWidget::logDumpZone(Player *player, CardZoneLogic *zone, int numberCards, bool isReversed)
void MessageLogWidget::logDumpZone(PlayerLogic *player, CardZoneLogic *zone, int numberCards, bool isReversed)
{
if (numberCards == -1) {
appendHtmlServerMessage(tr("%1 is looking at %2.")
@ -392,7 +395,7 @@ void MessageLogWidget::logDumpZone(Player *player, CardZoneLogic *zone, int numb
}
}
void MessageLogWidget::logFlipCard(Player *player, QString cardName, bool faceDown)
void MessageLogWidget::logFlipCard(PlayerLogic *player, QString cardName, bool faceDown)
{
if (faceDown) {
appendHtmlServerMessage(
@ -418,7 +421,7 @@ void MessageLogWidget::logGameFlooded()
appendMessage(tr("You are flooding the game. Please wait a couple of seconds."));
}
void MessageLogWidget::logJoin(Player *player)
void MessageLogWidget::logJoin(PlayerLogic *player)
{
soundEngine->playSound("player_join");
appendHtmlServerMessage(tr("%1 has joined the game.").arg(sanitizeHtml(player->getPlayerInfo()->getName())));
@ -435,7 +438,7 @@ void MessageLogWidget::logKicked()
appendHtmlServerMessage(tr("You have been kicked out of the game."), true);
}
void MessageLogWidget::logLeave(Player *player, QString reason)
void MessageLogWidget::logLeave(PlayerLogic *player, QString reason)
{
soundEngine->playSound("player_leave");
appendHtmlServerMessage(tr("%1 has left the game (%2).")
@ -450,13 +453,13 @@ void MessageLogWidget::logLeaveSpectator(QString name, QString reason)
.arg(sanitizeHtml(std::move(name)), sanitizeHtml(std::move(reason))));
}
void MessageLogWidget::logNotReadyStart(Player *player)
void MessageLogWidget::logNotReadyStart(PlayerLogic *player)
{
appendHtmlServerMessage(
tr("%1 is not ready to start the game any more.").arg(sanitizeHtml(player->getPlayerInfo()->getName())));
}
void MessageLogWidget::logMulligan(Player *player, int number)
void MessageLogWidget::logMulligan(PlayerLogic *player, int number)
{
if (!player) {
return;
@ -476,16 +479,16 @@ void MessageLogWidget::logReplayStarted(int gameId)
appendHtmlServerMessage(tr("You are watching a replay of game #%1.").arg(gameId));
}
void MessageLogWidget::logReadyStart(Player *player)
void MessageLogWidget::logReadyStart(PlayerLogic *player)
{
appendHtmlServerMessage(tr("%1 is ready to start the game.").arg(sanitizeHtml(player->getPlayerInfo()->getName())));
}
void MessageLogWidget::logRevealCards(Player *player,
void MessageLogWidget::logRevealCards(PlayerLogic *player,
CardZoneLogic *zone,
int cardId,
QString cardName,
Player *otherPlayer,
PlayerLogic *otherPlayer,
bool faceDown,
int amount,
bool isLentToAnotherPlayer)
@ -568,14 +571,14 @@ void MessageLogWidget::logRevealCards(Player *player,
}
}
void MessageLogWidget::logReverseTurn(Player *player, bool reversed)
void MessageLogWidget::logReverseTurn(PlayerLogic *player, bool reversed)
{
appendHtmlServerMessage(tr("%1 reversed turn order, now it's %2.")
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
.arg(reversed ? tr("reversed") : tr("normal")));
}
void MessageLogWidget::logRollDie(Player *player, int sides, const QList<uint> &rolls)
void MessageLogWidget::logRollDie(PlayerLogic *player, int sides, const QList<uint> &rolls)
{
if (rolls.length() == 1) {
const auto roll = rolls.at(0);
@ -612,7 +615,7 @@ void MessageLogWidget::logRollDie(Player *player, int sides, const QList<uint> &
soundEngine->playSound("roll_dice");
}
void MessageLogWidget::logSay(Player *player, QString message)
void MessageLogWidget::logSay(PlayerLogic *player, QString message)
{
appendMessage(std::move(message), {}, *player->getPlayerInfo()->getUserInfo(), true);
}
@ -627,13 +630,13 @@ void MessageLogWidget::logSetActivePhase(int phaseNumber)
phase.getName() + "</b></font>");
}
void MessageLogWidget::logSetActivePlayer(Player *player)
void MessageLogWidget::logSetActivePlayer(PlayerLogic *player)
{
appendHtml("<br><font color=\"green\"><b>" + QDateTime::currentDateTime().toString("[hh:mm:ss] ") +
QString(tr("%1's turn.")).arg(player->getPlayerInfo()->getName()) + "</b></font><br>");
}
void MessageLogWidget::logSetAnnotation(Player *player, CardItem *card, QString newAnnotation)
void MessageLogWidget::logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation)
{
appendHtmlServerMessage(
QString(tr("%1 sets annotation of %2 to %3."))
@ -642,7 +645,7 @@ void MessageLogWidget::logSetAnnotation(Player *player, CardItem *card, QString
.arg(QString("&quot;<font class=\"blue\">%1</font>&quot;").arg(sanitizeHtml(std::move(newAnnotation)))));
}
void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int counterId, int value, int oldValue)
void MessageLogWidget::logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue)
{
QString finalStr;
int delta = abs(oldValue - value);
@ -660,7 +663,7 @@ void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int c
.arg(value));
}
void MessageLogWidget::logSetCounter(Player *player, QString counterName, int value, int oldValue)
void MessageLogWidget::logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue)
{
if (counterName == "life") {
soundEngine->playSound("life_change");
@ -675,7 +678,7 @@ void MessageLogWidget::logSetCounter(Player *player, QString counterName, int va
.arg(value - oldValue));
}
void MessageLogWidget::logSetDoesntUntap(Player *player, CardItem *card, bool doesntUntap)
void MessageLogWidget::logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap)
{
QString str;
if (doesntUntap) {
@ -686,7 +689,7 @@ void MessageLogWidget::logSetDoesntUntap(Player *player, CardItem *card, bool do
appendHtmlServerMessage(str.arg(sanitizeHtml(player->getPlayerInfo()->getName())).arg(cardLink(card->getName())));
}
void MessageLogWidget::logSetPT(Player *player, CardItem *card, QString newPT)
void MessageLogWidget::logSetPT(PlayerLogic *player, CardItem *card, QString newPT)
{
if (currentContext == MessageContext_MoveCard) {
return;
@ -713,7 +716,7 @@ void MessageLogWidget::logSetPT(Player *player, CardItem *card, QString newPT)
}
}
void MessageLogWidget::logSetSideboardLock(Player *player, bool locked)
void MessageLogWidget::logSetSideboardLock(PlayerLogic *player, bool locked)
{
if (locked) {
appendHtmlServerMessage(
@ -724,7 +727,7 @@ void MessageLogWidget::logSetSideboardLock(Player *player, bool locked)
}
}
void MessageLogWidget::logSetTapped(Player *player, CardItem *card, bool tapped)
void MessageLogWidget::logSetTapped(PlayerLogic *player, CardItem *card, bool tapped)
{
if (currentContext == MessageContext_MoveCard) {
return;
@ -747,7 +750,7 @@ void MessageLogWidget::logSetTapped(Player *player, CardItem *card, bool tapped)
}
}
void MessageLogWidget::logShuffle(Player *player, CardZoneLogic *zone, int start, int end)
void MessageLogWidget::logShuffle(PlayerLogic *player, CardZoneLogic *zone, int start, int end)
{
if (currentContext == MessageContext_Mulligan) {
return;
@ -784,14 +787,14 @@ void MessageLogWidget::logSpectatorSay(const ServerInfo_User &spectator, QString
appendMessage(std::move(message), {}, spectator, false);
}
void MessageLogWidget::logUnattachCard(Player *player, QString cardName)
void MessageLogWidget::logUnattachCard(PlayerLogic *player, QString cardName)
{
appendHtmlServerMessage(tr("%1 unattaches %2.")
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
.arg(cardLink(std::move(cardName))));
}
void MessageLogWidget::logUndoDraw(Player *player, QString cardName)
void MessageLogWidget::logUndoDraw(PlayerLogic *player, QString cardName)
{
if (cardName.isEmpty()) {
appendHtmlServerMessage(tr("%1 undoes their last draw.").arg(sanitizeHtml(player->getPlayerInfo()->getName())));

View file

@ -13,7 +13,7 @@
class AbstractGame;
class CardItem;
class GameEventContext;
class Player;
class PlayerLogic;
class PlayerEventHandler;
class MessageLogWidget : public ChatView
@ -39,66 +39,66 @@ public:
public slots:
void containerProcessingDone();
void containerProcessingStarted(const GameEventContext &context);
void logAlwaysRevealTopCard(Player *player, CardZoneLogic *zone, bool reveal);
void logAlwaysLookAtTopCard(Player *player, CardZoneLogic *zone, bool reveal);
void logAttachCard(Player *player, QString cardName, Player *targetPlayer, QString targetCardName);
void logAlwaysRevealTopCard(PlayerLogic *player, CardZoneLogic *zone, bool reveal);
void logAlwaysLookAtTopCard(PlayerLogic *player, CardZoneLogic *zone, bool reveal);
void logAttachCard(PlayerLogic *player, QString cardName, PlayerLogic *targetPlayer, QString targetCardName);
void logConcede(int playerId);
void logUnconcede(int playerId);
void logConnectionStateChanged(Player *player, bool connectionState);
void logCreateArrow(Player *player,
Player *startPlayer,
void logConnectionStateChanged(PlayerLogic *player, bool connectionState);
void logCreateArrow(PlayerLogic *player,
PlayerLogic *startPlayer,
QString startCard,
Player *targetPlayer,
PlayerLogic *targetPlayer,
QString targetCard,
bool playerTarget);
void logCreateToken(Player *player, QString cardName, QString pt, bool faceDown);
void logDeckSelect(Player *player, QString deckHash, int sideboardSize);
void logDestroyCard(Player *player, QString cardName);
void logDrawCards(Player *player, int number, bool deckIsEmpty);
void logDumpZone(Player *player, CardZoneLogic *zone, int numberCards, bool isReversed = false);
void logFlipCard(Player *player, QString cardName, bool faceDown);
void logCreateToken(PlayerLogic *player, QString cardName, QString pt, bool faceDown);
void logDeckSelect(PlayerLogic *player, QString deckHash, int sideboardSize);
void logDestroyCard(PlayerLogic *player, QString cardName);
void logDrawCards(PlayerLogic *player, int number, bool deckIsEmpty);
void logDumpZone(PlayerLogic *player, CardZoneLogic *zone, int numberCards, bool isReversed = false);
void logFlipCard(PlayerLogic *player, QString cardName, bool faceDown);
void logGameClosed();
void logGameStart();
void logGameFlooded();
void logJoin(Player *player);
void logJoin(PlayerLogic *player);
void logJoinSpectator(QString name);
void logKicked();
void logLeave(Player *player, QString reason);
void logLeave(PlayerLogic *player, QString reason);
void logLeaveSpectator(QString name, QString reason);
void logNotReadyStart(Player *player);
void logMoveCard(Player *player,
void logNotReadyStart(PlayerLogic *player);
void logMoveCard(PlayerLogic *player,
CardItem *card,
CardZoneLogic *startZone,
int oldX,
CardZoneLogic *targetZone,
int newX);
void logMulligan(Player *player, int number);
void logMulligan(PlayerLogic *player, int number);
void logReplayStarted(int gameId);
void logReadyStart(Player *player);
void logRevealCards(Player *player,
void logReadyStart(PlayerLogic *player);
void logRevealCards(PlayerLogic *player,
CardZoneLogic *zone,
int cardId,
QString cardName,
Player *otherPlayer,
PlayerLogic *otherPlayer,
bool faceDown,
int amount,
bool isLentToAnotherPlayer);
void logReverseTurn(Player *player, bool reversed);
void logRollDie(Player *player, int sides, const QList<uint> &rolls);
void logSay(Player *player, QString message);
void logReverseTurn(PlayerLogic *player, bool reversed);
void logRollDie(PlayerLogic *player, int sides, const QList<uint> &rolls);
void logSay(PlayerLogic *player, QString message);
void logSetActivePhase(int phase);
void logSetActivePlayer(Player *player);
void logSetAnnotation(Player *player, CardItem *card, QString newAnnotation);
void logSetCardCounter(Player *player, QString cardName, int counterId, int value, int oldValue);
void logSetCounter(Player *player, QString counterName, int value, int oldValue);
void logSetDoesntUntap(Player *player, CardItem *card, bool doesntUntap);
void logSetPT(Player *player, CardItem *card, QString newPT);
void logSetSideboardLock(Player *player, bool locked);
void logSetTapped(Player *player, CardItem *card, bool tapped);
void logShuffle(Player *player, CardZoneLogic *zone, int start, int end);
void logSetActivePlayer(PlayerLogic *player);
void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation);
void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue);
void logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue);
void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap);
void logSetPT(PlayerLogic *player, CardItem *card, QString newPT);
void logSetSideboardLock(PlayerLogic *player, bool locked);
void logSetTapped(PlayerLogic *player, CardItem *card, bool tapped);
void logShuffle(PlayerLogic *player, CardZoneLogic *zone, int start, int end);
void logSpectatorSay(const ServerInfo_User &spectator, QString message);
void logUnattachCard(Player *player, QString cardName);
void logUndoDraw(Player *player, QString cardName);
void logUnattachCard(PlayerLogic *player, QString cardName);
void logUndoDraw(PlayerLogic *player, QString cardName);
void setContextJudgeName(QString player);
void appendHtmlServerMessage(const QString &html,
bool optionalIsBold = false,

View file

@ -21,7 +21,7 @@ namespace protobuf
class Message;
}
} // namespace google
class Player;
class PlayerLogic;
class GameCommand;
class PhaseButton : public QObject, public QGraphicsItem

View file

@ -5,8 +5,8 @@
#include "../../board/card_item.h"
#include "../../zones/view_zone_logic.h"
#include "../card_menu_action_type.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
#include "move_menu.h"
#include "pt_menu.h"
@ -14,12 +14,12 @@
#include <libcockatrice/card/relation/card_relation.h>
#include <libcockatrice/utility/zone_names.h>
CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive)
CardMenu::CardMenu(PlayerLogic *_player, const CardItem *_card, bool _shortcutsActive)
: player(_player), card(_card), shortcutsActive(_shortcutsActive)
{
auto playerActions = player->getPlayerActions();
const QList<Player *> &players = player->getGame()->getPlayerManager()->getPlayers().values();
const QList<PlayerLogic *> &players = player->getGame()->getPlayerManager()->getPlayers().values();
for (auto playerToAdd : players) {
if (playerToAdd == player) {
@ -137,7 +137,7 @@ CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive
}
}
void CardMenu::removePlayer(Player *playerToRemove)
void CardMenu::removePlayer(PlayerLogic *playerToRemove)
{
for (auto it = playersInfo.begin(); it != playersInfo.end();) {
if (it->second == playerToRemove->getPlayerInfo()->getId()) {

View file

@ -10,14 +10,14 @@
#include <QMenu>
class CardItem;
class Player;
class PlayerLogic;
class CardMenu : public QMenu
{
Q_OBJECT
public:
explicit CardMenu(Player *player, const CardItem *card, bool shortcutsActive);
void removePlayer(Player *playerToRemove);
explicit CardMenu(PlayerLogic *player, const CardItem *card, bool shortcutsActive);
void removePlayer(PlayerLogic *playerToRemove);
void createTableMenu(bool canModifyCard);
void createStackMenu(bool canModifyCard);
void createGraveyardOrExileMenu(bool canModifyCard);
@ -41,7 +41,7 @@ public:
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
private:
Player *player;
PlayerLogic *player;
const CardItem *card;
QList<QPair<QString, int>> playersInfo;
bool shortcutsActive;

View file

@ -1,13 +1,13 @@
#include "custom_zone_menu.h"
#include "../player.h"
#include "../player_logic.h"
CustomZoneMenu::CustomZoneMenu(Player *_player) : player(_player)
CustomZoneMenu::CustomZoneMenu(PlayerLogic *_player) : player(_player)
{
menuAction()->setVisible(false);
connect(player, &Player::clearCustomZonesMenu, this, &CustomZoneMenu::clearCustomZonesMenu);
connect(player, &Player::addViewCustomZoneActionToCustomZoneMenu, this,
connect(player, &PlayerLogic::clearCustomZonesMenu, this, &CustomZoneMenu::clearCustomZonesMenu);
connect(player, &PlayerLogic::addViewCustomZoneActionToCustomZoneMenu, this,
&CustomZoneMenu::addViewCustomZoneActionToCustomZoneMenu);
retranslateUi();

View file

@ -11,12 +11,12 @@
#include <QMenu>
class Player;
class PlayerLogic;
class CustomZoneMenu : public QMenu, public AbstractPlayerComponent
{
Q_OBJECT
public:
explicit CustomZoneMenu(Player *player);
explicit CustomZoneMenu(PlayerLogic *player);
void retranslateUi() override;
void setShortcutsActive() override
{
@ -26,7 +26,7 @@ public:
}
private:
Player *player;
PlayerLogic *player;
private slots:
void clearCustomZonesMenu();
void addViewCustomZoneActionToCustomZoneMenu(QString zoneName);

View file

@ -1,14 +1,14 @@
#include "grave_menu.h"
#include "../../abstract_game.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
#include <QAction>
#include <QMenu>
#include <libcockatrice/utility/zone_names.h>
GraveyardMenu::GraveyardMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
GraveyardMenu::GraveyardMenu(PlayerLogic *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
{
createMoveActions();
createViewActions();

View file

@ -13,7 +13,7 @@
#include <QAction>
#include <QMenu>
class Player;
class PlayerLogic;
class GraveyardMenu : public TearOffMenu, public AbstractPlayerComponent
{
Q_OBJECT
@ -21,7 +21,7 @@ signals:
void newPlayerActionCreated(QAction *action);
public:
explicit GraveyardMenu(Player *player, QWidget *parent = nullptr);
explicit GraveyardMenu(PlayerLogic *player, QWidget *parent = nullptr);
void createMoveActions();
void createViewActions();
void populateRevealRandomMenuWithActivePlayers();
@ -40,7 +40,7 @@ public:
QAction *aMoveGraveToRfg = nullptr;
private:
Player *player;
PlayerLogic *player;
};
#endif // COCKATRICE_GRAVE_MENU_H

View file

@ -4,14 +4,14 @@
#include "../../../client/settings/shortcuts_settings.h"
#include "../../../game_graphics/zones/hand_zone.h"
#include "../../abstract_game.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
#include <QAction>
#include <QMenu>
#include <libcockatrice/utility/zone_names.h>
HandMenu::HandMenu(Player *_player, PlayerActions *actions, QWidget *parent) : TearOffMenu(parent), player(_player)
HandMenu::HandMenu(PlayerLogic *_player, PlayerActions *actions, QWidget *parent) : TearOffMenu(parent), player(_player)
{
if (player->getPlayerInfo()->local || player->getPlayerInfo()->judge) {
aViewHand = new QAction(this);

View file

@ -13,7 +13,7 @@
#include <QAction>
#include <QMenu>
class Player;
class PlayerLogic;
class PlayerActions;
class HandMenu : public TearOffMenu, public AbstractPlayerComponent
@ -21,7 +21,7 @@ class HandMenu : public TearOffMenu, public AbstractPlayerComponent
Q_OBJECT
public:
HandMenu(Player *player, PlayerActions *actions, QWidget *parent = nullptr);
HandMenu(PlayerLogic *player, PlayerActions *actions, QWidget *parent = nullptr);
QMenu *revealHandMenu() const
{
@ -43,7 +43,7 @@ private slots:
void onRevealRandomHandCardTriggered();
private:
Player *player;
PlayerLogic *player;
QAction *aViewHand = nullptr;
QAction *aMulligan = nullptr;

View file

@ -4,13 +4,13 @@
#include "../../../client/settings/shortcuts_settings.h"
#include "../../../interface/widgets/tabs/tab_game.h"
#include "../../abstract_game.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
#include <QAction>
#include <QMenu>
LibraryMenu::LibraryMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
LibraryMenu::LibraryMenu(PlayerLogic *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
{
createDrawActions();
createShuffleActions();
@ -75,8 +75,8 @@ LibraryMenu::LibraryMenu(Player *_player, QWidget *parent) : TearOffMenu(parent)
bottomLibraryMenu->addSeparator();
bottomLibraryMenu->addAction(aShuffleBottomCards);
connect(player, &Player::resetTopCardMenuActions, this, &LibraryMenu::resetTopCardMenuActions);
connect(player, &Player::deckChanged, this, &LibraryMenu::enableOpenInDeckEditorAction);
connect(player, &PlayerLogic::resetTopCardMenuActions, this, &LibraryMenu::resetTopCardMenuActions);
connect(player, &PlayerLogic::deckChanged, this, &LibraryMenu::enableOpenInDeckEditorAction);
retranslateUi();
}

View file

@ -13,7 +13,7 @@
#include <QAction>
#include <QMenu>
class Player;
class PlayerLogic;
class PlayerActions;
class LibraryMenu : public TearOffMenu, public AbstractPlayerComponent
@ -24,7 +24,7 @@ public slots:
void resetTopCardMenuActions();
public:
LibraryMenu(Player *player, QWidget *parent = nullptr);
LibraryMenu(PlayerLogic *player, QWidget *parent = nullptr);
void createDrawActions();
void createShuffleActions();
void createMoveActions();
@ -111,7 +111,7 @@ public:
int defaultNumberTopCards = 1;
private:
Player *player;
PlayerLogic *player;
};
#endif // COCKATRICE_LIBRARY_MENU_H

View file

@ -1,10 +1,10 @@
#include "move_menu.h"
#include "../card_menu_action_type.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
MoveMenu::MoveMenu(Player *player) : QMenu(tr("Move to"))
MoveMenu::MoveMenu(PlayerLogic *player) : QMenu(tr("Move to"))
{
aMoveToTopLibrary = new QAction(this);
aMoveToTopLibrary->setData(cmMoveToTopLibrary);

View file

@ -8,13 +8,13 @@
#define COCKATRICE_MOVE_MENU_H
#include <QMenu>
class Player;
class PlayerLogic;
class MoveMenu : public QMenu
{
Q_OBJECT
public:
explicit MoveMenu(Player *player);
explicit MoveMenu(PlayerLogic *player);
void setShortcutsActive();
void retranslateUi();

View file

@ -10,7 +10,7 @@
#include <libcockatrice/protocol/pb/command_reveal_cards.pb.h>
PlayerMenu::PlayerMenu(Player *_player) : QObject(_player), player(_player)
PlayerMenu::PlayerMenu(PlayerLogic *_player) : QObject(_player), player(_player)
{
playerMenu = new TearOffMenu();

View file

@ -8,7 +8,7 @@
#define COCKATRICE_PLAYER_MENU_H
#include "../../../interface/widgets/menus/tearoff_menu.h"
#include "../player.h"
#include "../player_logic.h"
#include "custom_zone_menu.h"
#include "grave_menu.h"
#include "hand_menu.h"
@ -37,7 +37,7 @@ private slots:
void refreshShortcuts();
public:
explicit PlayerMenu(Player *player);
explicit PlayerMenu(PlayerLogic *player);
/// Lifecycle methods: delegate to all managedComponents, plus counters separately via player->getCounters().
void retranslateUi();
@ -74,7 +74,7 @@ public:
void setShortcutsInactive();
private:
Player *player;
PlayerLogic *player;
TearOffMenu *playerMenu;
QMenu *countersMenu;
HandMenu *handMenu;

View file

@ -1,9 +1,9 @@
#include "pt_menu.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
PtMenu::PtMenu(Player *player) : QMenu(tr("Power / toughness"))
PtMenu::PtMenu(PlayerLogic *player) : QMenu(tr("Power / toughness"))
{
PlayerActions *playerActions = player->getPlayerActions();

View file

@ -8,14 +8,14 @@
#define COCKATRICE_PT_MENU_H
#include <QMenu>
class Player;
class PlayerLogic;
class PtMenu : public QMenu
{
Q_OBJECT
public:
explicit PtMenu(Player *player);
explicit PtMenu(PlayerLogic *player);
void retranslateUi();
void setShortcutsActive();

View file

@ -1,11 +1,11 @@
#include "rfg_menu.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
#include <libcockatrice/utility/zone_names.h>
RfgMenu::RfgMenu(Player *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
RfgMenu::RfgMenu(PlayerLogic *_player, QWidget *parent) : TearOffMenu(parent), player(_player)
{
createMoveActions();
createViewActions();

View file

@ -13,12 +13,12 @@
#include <QAction>
#include <QMenu>
class Player;
class PlayerLogic;
class RfgMenu : public TearOffMenu, public AbstractPlayerComponent
{
Q_OBJECT
public:
explicit RfgMenu(Player *player, QWidget *parent = nullptr);
explicit RfgMenu(PlayerLogic *player, QWidget *parent = nullptr);
void createMoveActions();
void createViewActions();
void retranslateUi() override;
@ -38,7 +38,7 @@ public:
QAction *aMoveRfgToGrave = nullptr;
private:
Player *player;
PlayerLogic *player;
};
#endif // COCKATRICE_RFG_MENU_H

View file

@ -1,10 +1,10 @@
#include "say_menu.h"
#include "../../../client/settings/cache_settings.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
SayMenu::SayMenu(Player *_player) : player(_player)
SayMenu::SayMenu(PlayerLogic *_player) : player(_player)
{
connect(&SettingsCache::instance().messages(), &MessageSettings::messageMacrosChanged, this, &SayMenu::initSayMenu);
initSayMenu();

View file

@ -11,12 +11,12 @@
#include <QMenu>
class Player;
class PlayerLogic;
class SayMenu : public QMenu, public AbstractPlayerComponent
{
Q_OBJECT
public:
explicit SayMenu(Player *player);
explicit SayMenu(PlayerLogic *player);
void retranslateUi() override;
void setShortcutsActive() override;
@ -26,7 +26,7 @@ private slots:
void initSayMenu();
private:
Player *player;
PlayerLogic *player;
bool shortcutsActive = false;
};

View file

@ -1,9 +1,9 @@
#include "sideboard_menu.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
SideboardMenu::SideboardMenu(Player *player, QMenu *playerMenu) : QMenu(playerMenu)
SideboardMenu::SideboardMenu(PlayerLogic *player, QMenu *playerMenu) : QMenu(playerMenu)
{
aViewSideboard = new QAction(this);
connect(aViewSideboard, &QAction::triggered, player->getPlayerActions(), &PlayerActions::actViewSideboard);

View file

@ -11,19 +11,19 @@
#include <QMenu>
class Player;
class PlayerLogic;
class SideboardMenu : public QMenu, public AbstractPlayerComponent
{
Q_OBJECT
public:
explicit SideboardMenu(Player *player, QMenu *playerMenu);
explicit SideboardMenu(PlayerLogic *player, QMenu *playerMenu);
void retranslateUi() override;
void setShortcutsActive() override;
void setShortcutsInactive() override;
private:
Player *player;
PlayerLogic *player;
QAction *aViewSideboard;
};

View file

@ -1,14 +1,14 @@
#include "utility_menu.h"
#include "../../../interface/deck_loader/deck_loader.h"
#include "../player.h"
#include "../player_actions.h"
#include "../player_logic.h"
#include "player_menu.h"
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
#include <libcockatrice/deck_list/tree/inner_deck_list_node.h>
UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu), player(_player)
UtilityMenu::UtilityMenu(PlayerLogic *_player, QMenu *playerMenu) : QMenu(playerMenu), player(_player)
{
PlayerActions *playerActions = player->getPlayerActions();
@ -30,11 +30,11 @@ UtilityMenu::UtilityMenu(Player *_player, QMenu *playerMenu) : QMenu(playerMenu)
aCreateAnotherToken->setEnabled(false);
aIncrementAllCardCounters = new QAction(this);
connect(aIncrementAllCardCounters, &QAction::triggered, player, &Player::incrementAllCardCounters);
connect(aIncrementAllCardCounters, &QAction::triggered, player, &PlayerLogic::incrementAllCardCounters);
createPredefinedTokenMenu = new QMenu(QString());
createPredefinedTokenMenu->setEnabled(false);
connect(player, &Player::deckChanged, this, &UtilityMenu::populatePredefinedTokensMenu);
connect(player, &PlayerLogic::deckChanged, this, &UtilityMenu::populatePredefinedTokensMenu);
playerMenu->addAction(aIncrementAllCardCounters);
playerMenu->addSeparator();

View file

@ -11,7 +11,7 @@
#include <QMenu>
class Player;
class PlayerLogic;
class UtilityMenu : public QMenu, public AbstractPlayerComponent
{
Q_OBJECT
@ -22,7 +22,7 @@ public slots:
void setShortcutsInactive() override;
public:
explicit UtilityMenu(Player *player, QMenu *playerMenu);
explicit UtilityMenu(PlayerLogic *player, QMenu *playerMenu);
[[nodiscard]] bool createAnotherTokenActionExists() const
{
@ -41,7 +41,7 @@ public:
}
private:
Player *player;
PlayerLogic *player;
QStringList predefinedTokens;
QMenu *createPredefinedTokenMenu;

View file

@ -36,7 +36,7 @@
// milliseconds in between triggers of the move top cards until action
static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100;
PlayerActions::PlayerActions(Player *_player)
PlayerActions::PlayerActions(PlayerLogic *_player)
: QObject(_player), player(_player), lastTokenTableRow(0), movingCardsUntil(false)
{
moveTopCardTimer = new QTimer(this);
@ -1770,7 +1770,7 @@ void PlayerActions::cardMenuAction()
return;
}
Player *startPlayer = zone->getPlayer();
PlayerLogic *startPlayer = zone->getPlayer();
if (!startPlayer) {
return;
}

View file

@ -10,7 +10,7 @@
#include "../dialogs/dlg_create_token.h"
#include "../dialogs/dlg_move_top_cards_until.h"
#include "event_processing_options.h"
#include "player.h"
#include "player_logic.h"
#include <QMenu>
#include <QObject>
@ -29,7 +29,7 @@ class CardItem;
class Command_MoveCard;
class GameEventContext;
class PendingCommand;
class Player;
class PlayerLogic;
class PlayerActions : public QObject
{
Q_OBJECT
@ -40,7 +40,7 @@ public:
RANDOM_CARD_FROM_ZONE = -2
};
explicit PlayerActions(Player *player);
explicit PlayerActions(PlayerLogic *player);
void sendGameCommand(PendingCommand *pend);
void sendGameCommand(const google::protobuf::Message &command);
@ -159,7 +159,7 @@ public slots:
void cardMenuAction();
private:
Player *player;
PlayerLogic *player;
int defaultNumberTopCards = 1;
int defaultNumberTopCardsToPlaceBelow = 1;

View file

@ -5,8 +5,8 @@
#include "../board/arrow_item.h"
#include "../board/card_item.h"
#include "../board/card_list.h"
#include "player.h"
#include "player_actions.h"
#include "player_logic.h"
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
@ -32,7 +32,7 @@
#include <libcockatrice/protocol/pb/event_shuffle.pb.h>
#include <libcockatrice/utility/zone_names.h>
PlayerEventHandler::PlayerEventHandler(Player *_player) : QObject(_player), player(_player)
PlayerEventHandler::PlayerEventHandler(PlayerLogic *_player) : QObject(_player), player(_player)
{
}
@ -261,7 +261,7 @@ void PlayerEventHandler::eventDelCounter(const Event_DelCounter &event)
void PlayerEventHandler::eventDumpZone(const Event_DumpZone &event)
{
Player *zoneOwner = player->getGame()->getPlayerManager()->getPlayers().value(event.zone_owner_id(), 0);
PlayerLogic *zoneOwner = player->getGame()->getPlayerManager()->getPlayers().value(event.zone_owner_id(), 0);
if (!zoneOwner) {
return;
}
@ -274,13 +274,13 @@ void PlayerEventHandler::eventDumpZone(const Event_DumpZone &event)
void PlayerEventHandler::eventMoveCard(const Event_MoveCard &event, const GameEventContext &context)
{
Player *startPlayer = player->getGame()->getPlayerManager()->getPlayers().value(event.start_player_id());
PlayerLogic *startPlayer = player->getGame()->getPlayerManager()->getPlayers().value(event.start_player_id());
if (!startPlayer) {
return;
}
QString startZoneString = QString::fromStdString(event.start_zone());
CardZoneLogic *startZone = startPlayer->getZones().value(startZoneString, 0);
Player *targetPlayer = player->getGame()->getPlayerManager()->getPlayers().value(event.target_player_id());
PlayerLogic *targetPlayer = player->getGame()->getPlayerManager()->getPlayers().value(event.target_player_id());
if (!targetPlayer) {
return;
}
@ -353,9 +353,9 @@ void PlayerEventHandler::eventMoveCard(const Event_MoveCard &event, const GameEv
// Look at all arrows from and to the card.
// If the card was moved to another zone, delete the arrows, otherwise update them.
QMapIterator<int, Player *> playerIterator(player->getGame()->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> playerIterator(player->getGame()->getPlayerManager()->getPlayers());
while (playerIterator.hasNext()) {
Player *p = playerIterator.next().value();
PlayerLogic *p = playerIterator.next().value();
QList<ArrowItem *> arrowsToDelete;
QMapIterator<int, ArrowItem *> arrowIterator(p->getArrows());
@ -428,8 +428,8 @@ void PlayerEventHandler::eventDestroyCard(const Event_DestroyCard &event)
void PlayerEventHandler::eventAttachCard(const Event_AttachCard &event)
{
const QMap<int, Player *> &playerList = player->getGame()->getPlayerManager()->getPlayers();
Player *targetPlayer = nullptr;
const QMap<int, PlayerLogic *> &playerList = player->getGame()->getPlayerManager()->getPlayers();
PlayerLogic *targetPlayer = nullptr;
CardZoneLogic *targetZone = nullptr;
CardItem *targetCard = nullptr;
if (event.has_target_player_id()) {
@ -506,7 +506,7 @@ void PlayerEventHandler::eventRevealCards(const Event_RevealCards &event, EventP
if (!zone) {
return;
}
Player *otherPlayer = nullptr;
PlayerLogic *otherPlayer = nullptr;
if (event.has_other_player_id()) {
otherPlayer = player->getGame()->getPlayerManager()->getPlayers().value(event.other_player_id());
if (!otherPlayer) {

View file

@ -15,7 +15,7 @@
class CardItem;
class CardZoneLogic;
class Player;
class PlayerLogic;
class Event_AttachCard;
class Event_ChangeZoneProperties;
class Event_CreateArrow;
@ -40,48 +40,48 @@ class PlayerEventHandler : public QObject
Q_OBJECT
signals:
void logSay(Player *player, QString message);
void logShuffle(Player *player, CardZoneLogic *zone, int start, int end);
void logRollDie(Player *player, int sides, const QList<uint> &rolls);
void logCreateArrow(Player *player,
Player *startPlayer,
void logSay(PlayerLogic *player, QString message);
void logShuffle(PlayerLogic *player, CardZoneLogic *zone, int start, int end);
void logRollDie(PlayerLogic *player, int sides, const QList<uint> &rolls);
void logCreateArrow(PlayerLogic *player,
PlayerLogic *startPlayer,
QString startCard,
Player *targetPlayer,
PlayerLogic *targetPlayer,
QString targetCard,
bool _playerTarget);
void logCreateToken(Player *player, QString cardName, QString pt, bool faceDown);
void logDrawCards(Player *player, int number, bool deckIsEmpty);
void logUndoDraw(Player *player, QString cardName);
void logMoveCard(Player *player,
void logCreateToken(PlayerLogic *player, QString cardName, QString pt, bool faceDown);
void logDrawCards(PlayerLogic *player, int number, bool deckIsEmpty);
void logUndoDraw(PlayerLogic *player, QString cardName);
void logMoveCard(PlayerLogic *player,
CardItem *card,
CardZoneLogic *startZone,
int oldX,
CardZoneLogic *targetZone,
int newX);
void logFlipCard(Player *player, QString cardName, bool faceDown);
void logDestroyCard(Player *player, QString cardName);
void logAttachCard(Player *player, QString cardName, Player *targetPlayer, QString targetCardName);
void logUnattachCard(Player *player, QString cardName);
void logSetCardCounter(Player *player, QString cardName, int counterId, int value, int oldValue);
void logSetTapped(Player *player, CardItem *card, bool tapped);
void logSetCounter(Player *player, QString counterName, int value, int oldValue);
void logSetDoesntUntap(Player *player, CardItem *card, bool doesntUntap);
void logSetPT(Player *player, CardItem *card, QString newPT);
void logSetAnnotation(Player *player, CardItem *card, QString newAnnotation);
void logDumpZone(Player *player, CardZoneLogic *zone, int numberCards, bool isReversed = false);
void logRevealCards(Player *player,
void logFlipCard(PlayerLogic *player, QString cardName, bool faceDown);
void logDestroyCard(PlayerLogic *player, QString cardName);
void logAttachCard(PlayerLogic *player, QString cardName, PlayerLogic *targetPlayer, QString targetCardName);
void logUnattachCard(PlayerLogic *player, QString cardName);
void logSetCardCounter(PlayerLogic *player, QString cardName, int counterId, int value, int oldValue);
void logSetTapped(PlayerLogic *player, CardItem *card, bool tapped);
void logSetCounter(PlayerLogic *player, QString counterName, int value, int oldValue);
void logSetDoesntUntap(PlayerLogic *player, CardItem *card, bool doesntUntap);
void logSetPT(PlayerLogic *player, CardItem *card, QString newPT);
void logSetAnnotation(PlayerLogic *player, CardItem *card, QString newAnnotation);
void logDumpZone(PlayerLogic *player, CardZoneLogic *zone, int numberCards, bool isReversed = false);
void logRevealCards(PlayerLogic *player,
CardZoneLogic *zone,
int cardId,
QString cardName,
Player *otherPlayer,
PlayerLogic *otherPlayer,
bool faceDown,
int amount,
bool isLentToAnotherPlayer = false);
void logAlwaysRevealTopCard(Player *player, CardZoneLogic *zone, bool reveal);
void logAlwaysLookAtTopCard(Player *player, CardZoneLogic *zone, bool reveal);
void logAlwaysRevealTopCard(PlayerLogic *player, CardZoneLogic *zone, bool reveal);
void logAlwaysLookAtTopCard(PlayerLogic *player, CardZoneLogic *zone, bool reveal);
public:
PlayerEventHandler(Player *player);
PlayerEventHandler(PlayerLogic *player);
void processGameEvent(GameEvent::GameEventType type,
const GameEvent &event,
@ -110,7 +110,7 @@ public:
void eventChangeZoneProperties(const Event_ChangeZoneProperties &event);
private:
Player *player;
PlayerLogic *player;
void setCardAttrHelper(const GameEventContext &context,
CardItem *card,

View file

@ -8,15 +8,15 @@
#include "../board/abstract_card_item.h"
#include "../hand_counter.h"
PlayerGraphicsItem::PlayerGraphicsItem(Player *_player) : player(_player)
PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
{
connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this,
&PlayerGraphicsItem::rearrangeZones);
connect(&SettingsCache::instance(), &SettingsCache::handJustificationChanged, this,
&PlayerGraphicsItem::rearrangeZones);
connect(player, &Player::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
connect(player, &Player::concededChanged, this, [this](int, bool c) { setVisible(!c); });
connect(player, &Player::zoneIdChanged, this, [this](int id) { playerArea->setPlayerZoneId(id); });
connect(player, &PlayerLogic::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
connect(player, &PlayerLogic::concededChanged, this, [this](int, bool c) { setVisible(!c); });
connect(player, &PlayerLogic::zoneIdChanged, this, [this](int id) { playerArea->setPlayerZoneId(id); });
playerArea = new PlayerArea(this);

View file

@ -7,7 +7,7 @@
#ifndef COCKATRICE_PLAYER_GRAPHICS_ITEM_H
#define COCKATRICE_PLAYER_GRAPHICS_ITEM_H
#include "../game_scene.h"
#include "player.h"
#include "player_logic.h"
#include <QGraphicsObject>
@ -34,7 +34,7 @@ public:
static constexpr int counterAreaWidth = 55;
explicit PlayerGraphicsItem(Player *player);
explicit PlayerGraphicsItem(PlayerLogic *player);
void initializeZones();
[[nodiscard]] QRectF boundingRect() const override;
@ -54,7 +54,7 @@ public:
return static_cast<GameScene *>(scene());
}
Player *getPlayer() const
PlayerLogic *getPlayer() const
{
return player;
}
@ -109,7 +109,7 @@ signals:
void playerCountChanged();
private:
Player *player;
PlayerLogic *player;
PlayerArea *playerArea;
PlayerTarget *playerTarget;
PileZone *deckZoneGraphicsItem;

View file

@ -7,7 +7,7 @@
#ifndef PLAYERLISTWIDGET_H
#define PLAYERLISTWIDGET_H
#include "player.h"
#include "player_logic.h"
#include <QIcon>
#include <QMap>

View file

@ -1,4 +1,4 @@
#include "player.h"
#include "player_logic.h"
#include "../../game_graphics/zones/hand_zone.h"
#include "../../game_graphics/zones/pile_zone.h"
@ -29,7 +29,7 @@
#include <libcockatrice/protocol/pb/serverinfo_zone.pb.h>
#include <libcockatrice/utility/color.h>
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
PlayerLogic::PlayerLogic(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
conceded(false), zoneId(0), dialogSemaphore(false)
@ -40,12 +40,12 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, A
graphicsItem = new PlayerGraphicsItem(this);
playerMenu->setMenusForGraphicItems();
connect(this, &Player::activeChanged, graphicsItem, &PlayerGraphicsItem::onPlayerActiveChanged);
connect(this, &PlayerLogic::activeChanged, graphicsItem, &PlayerGraphicsItem::onPlayerActiveChanged);
connect(this, &Player::openDeckEditor, game->getTab(), &TabGame::openDeckEditor);
connect(this, &PlayerLogic::openDeckEditor, game->getTab(), &TabGame::openDeckEditor);
}
void Player::initializeZones()
void PlayerLogic::initializeZones()
{
addZone(new PileZoneLogic(this, ZoneNames::DECK, false, true, false, this));
addZone(new PileZoneLogic(this, ZoneNames::GRAVE, false, false, true, this));
@ -58,7 +58,7 @@ void Player::initializeZones()
addZone(new HandZoneLogic(this, ZoneNames::HAND, false, false, visibleHand, this));
}
Player::~Player()
PlayerLogic::~PlayerLogic()
{
qCInfo(PlayerLog) << "Player destructor:" << getPlayerInfo()->getName();
@ -72,7 +72,7 @@ Player::~Player()
delete getPlayerInfo()->userInfo;
}
void Player::clear()
void PlayerLogic::clear()
{
clearArrows();
@ -84,7 +84,7 @@ void Player::clear()
clearCounters();
}
void Player::setConceded(bool _conceded)
void PlayerLogic::setConceded(bool _conceded)
{
if (conceded != _conceded) {
conceded = _conceded;
@ -96,7 +96,7 @@ void Player::setConceded(bool _conceded)
}
}
void Player::setZoneId(int _zoneId)
void PlayerLogic::setZoneId(int _zoneId)
{
if (zoneId != _zoneId) {
zoneId = _zoneId;
@ -104,7 +104,7 @@ void Player::setZoneId(int _zoneId)
}
}
void Player::processPlayerInfo(const ServerInfo_Player &info)
void PlayerLogic::processPlayerInfo(const ServerInfo_Player &info)
{
static QSet<QString> builtinZones{/* PileZones */
ZoneNames::DECK, ZoneNames::GRAVE, ZoneNames::EXILE, ZoneNames::SIDEBOARD,
@ -202,7 +202,7 @@ void Player::processPlayerInfo(const ServerInfo_Player &info)
setConceded(info.properties().conceded());
}
void Player::processCardAttachment(const ServerInfo_Player &info)
void PlayerLogic::processCardAttachment(const ServerInfo_Player &info)
{
const int zoneListSize = info.zone_list_size();
for (int i = 0; i < zoneListSize; ++i) {
@ -235,12 +235,12 @@ void Player::processCardAttachment(const ServerInfo_Player &info)
}
}
void Player::addCard(CardItem *card)
void PlayerLogic::addCard(CardItem *card)
{
emit newCardAdded(card);
}
void Player::deleteCard(CardItem *card)
void PlayerLogic::deleteCard(CardItem *card)
{
if (card == nullptr) {
return;
@ -251,20 +251,20 @@ void Player::deleteCard(CardItem *card)
}
}
void Player::setDeck(const DeckList &_deck)
void PlayerLogic::setDeck(const DeckList &_deck)
{
deck = _deck;
emit deckChanged();
}
AbstractCounter *Player::addCounter(const ServerInfo_Counter &counter)
AbstractCounter *PlayerLogic::addCounter(const ServerInfo_Counter &counter)
{
return addCounter(counter.id(), QString::fromStdString(counter.name()),
convertColorToQColor(counter.counter_color()), counter.radius(), counter.count());
}
AbstractCounter *Player::addCounter(int counterId, const QString &name, QColor color, int radius, int value)
AbstractCounter *PlayerLogic::addCounter(int counterId, const QString &name, QColor color, int radius, int value)
{
if (counters.contains(counterId)) {
return nullptr;
@ -288,7 +288,7 @@ AbstractCounter *Player::addCounter(int counterId, const QString &name, QColor c
return ctr;
}
void Player::delCounter(int counterId)
void PlayerLogic::delCounter(int counterId)
{
AbstractCounter *ctr = counters.value(counterId, 0);
if (!ctr) {
@ -300,7 +300,7 @@ void Player::delCounter(int counterId)
emit rearrangeCounters();
}
void Player::clearCounters()
void PlayerLogic::clearCounters()
{
QMapIterator<int, AbstractCounter *> counterIterator(counters);
while (counterIterator.hasNext()) {
@ -309,7 +309,7 @@ void Player::clearCounters()
counters.clear();
}
void Player::incrementAllCardCounters()
void PlayerLogic::incrementAllCardCounters()
{
auto cardsToUpdate = getGameScene()->selectedCards();
if (cardsToUpdate.isEmpty()) {
@ -345,7 +345,7 @@ void Player::incrementAllCardCounters()
}
}
AbstractCounter *Player::getLifeCounter() const
AbstractCounter *PlayerLogic::getLifeCounter() const
{
for (auto counter : counters.values()) {
if (counter->getName() == "life") {
@ -355,11 +355,11 @@ AbstractCounter *Player::getLifeCounter() const
return nullptr;
}
ArrowItem *Player::addArrow(const ServerInfo_Arrow &arrow)
ArrowItem *PlayerLogic::addArrow(const ServerInfo_Arrow &arrow)
{
const QMap<int, Player *> &playerList = game->getPlayerManager()->getPlayers();
Player *startPlayer = playerList.value(arrow.start_player_id(), 0);
Player *targetPlayer = playerList.value(arrow.target_player_id(), 0);
const QMap<int, PlayerLogic *> &playerList = game->getPlayerManager()->getPlayers();
PlayerLogic *startPlayer = playerList.value(arrow.start_player_id(), 0);
PlayerLogic *targetPlayer = playerList.value(arrow.target_player_id(), 0);
if (!startPlayer || !targetPlayer) {
return nullptr;
}
@ -390,7 +390,7 @@ ArrowItem *Player::addArrow(const ServerInfo_Arrow &arrow)
}
}
ArrowItem *Player::addArrow(int arrowId, CardItem *startCard, ArrowTarget *targetItem, const QColor &color)
ArrowItem *PlayerLogic::addArrow(int arrowId, CardItem *startCard, ArrowTarget *targetItem, const QColor &color)
{
auto *arrow = new ArrowItem(this, arrowId, startCard, targetItem, color);
arrows.insert(arrowId, arrow);
@ -399,7 +399,7 @@ ArrowItem *Player::addArrow(int arrowId, CardItem *startCard, ArrowTarget *targe
return arrow;
}
void Player::delArrow(int arrowId)
void PlayerLogic::delArrow(int arrowId)
{
ArrowItem *arr = arrows.value(arrowId, 0);
if (!arr) {
@ -408,14 +408,14 @@ void Player::delArrow(int arrowId)
arr->delArrow();
}
void Player::removeArrow(ArrowItem *arrow)
void PlayerLogic::removeArrow(ArrowItem *arrow)
{
if (arrow->getId() != -1) {
arrows.remove(arrow->getId());
}
}
void Player::clearArrows()
void PlayerLogic::clearArrows()
{
QMapIterator<int, ArrowItem *> arrowIterator(arrows);
while (arrowIterator.hasNext()) {
@ -424,7 +424,7 @@ void Player::clearArrows()
arrows.clear();
}
bool Player::clearCardsToDelete()
bool PlayerLogic::clearCardsToDelete()
{
if (cardsToDelete.isEmpty()) {
return false;
@ -440,28 +440,28 @@ bool Player::clearCardsToDelete()
return true;
}
void Player::setActive(bool _active)
void PlayerLogic::setActive(bool _active)
{
active = _active;
emit activeChanged(active);
}
void Player::updateZones()
void PlayerLogic::updateZones()
{
getTableZone()->reorganizeCards();
}
PlayerGraphicsItem *Player::getGraphicsItem()
PlayerGraphicsItem *PlayerLogic::getGraphicsItem()
{
return graphicsItem;
}
GameScene *Player::getGameScene()
GameScene *PlayerLogic::getGameScene()
{
return getGraphicsItem()->getGameScene();
}
void Player::setGameStarted()
void PlayerLogic::setGameStarted()
{
if (playerInfo->local) {
emit resetTopCardMenuActions();

View file

@ -62,7 +62,7 @@ class TabGame;
const int MAX_TOKENS_PER_DIALOG = 99;
class Player : public QObject
class PlayerLogic : public QObject
{
Q_OBJECT
@ -82,8 +82,8 @@ public slots:
void setActive(bool _active);
public:
Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent);
~Player() override;
PlayerLogic(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent);
~PlayerLogic() override;
void initializeZones();
void updateZones();

View file

@ -1,35 +1,35 @@
#include "player_manager.h"
#include "../abstract_game.h"
#include "player.h"
#include "player_logic.h"
PlayerManager::PlayerManager(AbstractGame *_game,
int _localPlayerId,
bool _localPlayerIsJudge,
bool localPlayerIsSpectator)
: QObject(_game), game(_game), players(QMap<int, Player *>()), localPlayerId(_localPlayerId),
: QObject(_game), game(_game), players(QMap<int, PlayerLogic *>()), localPlayerId(_localPlayerId),
localPlayerIsJudge(_localPlayerIsJudge), localPlayerIsSpectator(localPlayerIsSpectator)
{
}
bool PlayerManager::isMainPlayerConceded() const
{
Player *player = players.value(localPlayerId, nullptr);
PlayerLogic *player = players.value(localPlayerId, nullptr);
return player && player->getConceded();
}
Player *PlayerManager::getActiveLocalPlayer(int activePlayer) const
PlayerLogic *PlayerManager::getActiveLocalPlayer(int activePlayer) const
{
Player *active = players.value(activePlayer, 0);
PlayerLogic *active = players.value(activePlayer, 0);
if (active) {
if (active->getPlayerInfo()->getLocal()) {
return active;
}
}
QMapIterator<int, Player *> playerIterator(players);
QMapIterator<int, PlayerLogic *> playerIterator(players);
while (playerIterator.hasNext()) {
Player *temp = playerIterator.next().value();
PlayerLogic *temp = playerIterator.next().value();
if (temp->getPlayerInfo()->getLocal()) {
return temp;
}
@ -43,11 +43,11 @@ bool PlayerManager::isLocalPlayer(int playerId)
return game->getGameState()->getIsLocalGame() || playerId == localPlayerId;
}
Player *PlayerManager::addPlayer(int playerId, const ServerInfo_User &info)
PlayerLogic *PlayerManager::addPlayer(int playerId, const ServerInfo_User &info)
{
auto *newPlayer = new Player(info, playerId, isLocalPlayer(playerId) || game->getGameState()->getIsLocalGame(),
isJudge(), getGame());
connect(newPlayer, &Player::concededChanged, this, &PlayerManager::onPlayerConceded);
auto *newPlayer = new PlayerLogic(info, playerId, isLocalPlayer(playerId) || game->getGameState()->getIsLocalGame(),
isJudge(), getGame());
connect(newPlayer, &PlayerLogic::concededChanged, this, &PlayerManager::onPlayerConceded);
players.insert(playerId, newPlayer);
emit playerAdded(newPlayer);
emit playerCountChanged();
@ -56,7 +56,7 @@ Player *PlayerManager::addPlayer(int playerId, const ServerInfo_User &info)
void PlayerManager::removePlayer(int playerId)
{
Player *player = getPlayer(playerId);
PlayerLogic *player = getPlayer(playerId);
if (!player) {
return;
}
@ -66,9 +66,9 @@ void PlayerManager::removePlayer(int playerId)
player->deleteLater();
}
Player *PlayerManager::getPlayer(int playerId) const
PlayerLogic *PlayerManager::getPlayer(int playerId) const
{
Player *player = players.value(playerId, 0);
PlayerLogic *player = players.value(playerId, 0);
if (!player) {
return nullptr;
}

View file

@ -12,7 +12,7 @@
#include <libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h>
class AbstractGame;
class Player;
class PlayerLogic;
class PlayerManager : public QObject
{
Q_OBJECT
@ -21,7 +21,7 @@ public:
PlayerManager(AbstractGame *_game, int _localPlayerId, bool _localPlayerIsJudge, bool localPlayerIsSpectator);
AbstractGame *game;
QMap<int, Player *> players;
QMap<int, PlayerLogic *> players;
int localPlayerId;
bool localPlayerIsJudge;
bool localPlayerIsSpectator;
@ -42,7 +42,7 @@ public:
return localPlayerId;
}
[[nodiscard]] const QMap<int, Player *> &getPlayers() const
[[nodiscard]] const QMap<int, PlayerLogic *> &getPlayers() const
{
return players;
}
@ -52,14 +52,14 @@ public:
return players.size();
}
[[nodiscard]] Player *getActiveLocalPlayer(int activePlayer) const;
[[nodiscard]] PlayerLogic *getActiveLocalPlayer(int activePlayer) const;
bool isLocalPlayer(int playerId);
Player *addPlayer(int playerId, const ServerInfo_User &info);
PlayerLogic *addPlayer(int playerId, const ServerInfo_User &info);
void removePlayer(int playerId);
[[nodiscard]] Player *getPlayer(int playerId) const;
[[nodiscard]] PlayerLogic *getPlayer(int playerId) const;
void onPlayerConceded(int playerId, bool conceded);
@ -106,8 +106,8 @@ public:
}
signals:
void playerAdded(Player *player);
void playerRemoved(Player *player);
void playerAdded(PlayerLogic *player);
void playerRemoved(PlayerLogic *player);
void activeLocalPlayerConceded();
void activeLocalPlayerUnconceded();
void playerConceded(int playerId);

View file

@ -1,7 +1,7 @@
#include "player_target.h"
#include "../../interface/pixel_map_generator.h"
#include "player.h"
#include "player_logic.h"
#include <QDebug>
#include <QPainter>
@ -9,7 +9,7 @@
#include <QtMath>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
PlayerCounter::PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent)
PlayerCounter::PlayerCounter(PlayerLogic *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent)
: AbstractCounter(_player, _id, _name, false, _value, false, parent)
{
}
@ -47,7 +47,7 @@ void PlayerCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*
painter->drawText(translatedRect, Qt::AlignCenter, QString::number(value));
}
PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem)
PlayerTarget::PlayerTarget(PlayerLogic *_owner, QGraphicsItem *parentItem)
: ArrowTarget(_owner, parentItem), playerCounter(nullptr)
{
setCacheMode(DeviceCoordinateCache);

View file

@ -13,13 +13,13 @@
#include <QPixmap>
class Player;
class PlayerLogic;
class PlayerCounter : public AbstractCounter
{
Q_OBJECT
public:
PlayerCounter(Player *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent = nullptr);
PlayerCounter(PlayerLogic *_player, int _id, const QString &_name, int _value, QGraphicsItem *parent = nullptr);
QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
};
@ -43,7 +43,7 @@ public:
return Type;
}
explicit PlayerTarget(Player *_player = nullptr, QGraphicsItem *parentItem = nullptr);
explicit PlayerTarget(PlayerLogic *_player = nullptr, QGraphicsItem *parentItem = nullptr);
~PlayerTarget() override;
QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

View file

@ -2,8 +2,8 @@
#include "../../game_graphics/zones/view_zone.h"
#include "../board/card_item.h"
#include "../player/player.h"
#include "../player/player_actions.h"
#include "../player/player_logic.h"
#include "view_zone_logic.h"
#include <QAction>
@ -20,7 +20,7 @@
* @param _contentsKnown whether the cards in the zone are known to the client
* @param parent the parent QObject.
*/
CardZoneLogic::CardZoneLogic(Player *_player,
CardZoneLogic::CardZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -15,7 +15,7 @@
inline Q_LOGGING_CATEGORY(CardZoneLogicLog, "card_zone_logic");
class Player;
class PlayerLogic;
class ZoneViewZone;
class QMenu;
class QAction;
@ -35,7 +35,7 @@ signals:
void retranslateUi();
public:
explicit CardZoneLogic(Player *_player,
explicit CardZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,
@ -68,7 +68,7 @@ public:
return name;
}
[[nodiscard]] QString getTranslatedName(bool theirOwn, GrammaticalCase gc) const;
[[nodiscard]] Player *getPlayer() const
[[nodiscard]] PlayerLogic *getPlayer() const
{
return player;
}
@ -105,7 +105,7 @@ private slots:
void refreshCardInfos();
protected:
Player *player;
PlayerLogic *player;
QString name;
CardList cards;
QList<ZoneViewZone *> views;

View file

@ -3,7 +3,7 @@
#include "../board/card_item.h"
#include "card_zone_algorithms.h"
HandZoneLogic::HandZoneLogic(Player *_player,
HandZoneLogic::HandZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -12,7 +12,7 @@ class HandZoneLogic : public CardZoneLogic
{
Q_OBJECT
public:
HandZoneLogic(Player *_player,
HandZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -2,7 +2,7 @@
#include "../board/card_item.h"
PileZoneLogic::PileZoneLogic(Player *_player,
PileZoneLogic::PileZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -17,7 +17,7 @@ signals:
void callUpdate();
public:
PileZoneLogic(Player *_player,
PileZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -3,7 +3,7 @@
#include "../board/card_item.h"
#include "card_zone_algorithms.h"
StackZoneLogic::StackZoneLogic(Player *_player,
StackZoneLogic::StackZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -12,7 +12,7 @@ class StackZoneLogic : public CardZoneLogic
{
Q_OBJECT
public:
StackZoneLogic(Player *_player,
StackZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -2,7 +2,7 @@
#include "../board/card_item.h"
TableZoneLogic::TableZoneLogic(Player *_player,
TableZoneLogic::TableZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -16,7 +16,7 @@ signals:
void toggleTapped();
public:
TableZoneLogic(Player *_player,
TableZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,
bool _isShufflable,

View file

@ -9,7 +9,7 @@
* @param _revealZone if false, the cards will be face down.
* @param _writeableRevealZone whether the player can interact with the revealed cards.
*/
ZoneViewZoneLogic::ZoneViewZoneLogic(Player *_player,
ZoneViewZoneLogic::ZoneViewZoneLogic(PlayerLogic *_player,
CardZoneLogic *_origZone,
int _numberCards,
bool _revealZone,

View file

@ -30,7 +30,7 @@ public:
REMOVE_CARD
};
ZoneViewZoneLogic(Player *_player,
ZoneViewZoneLogic(PlayerLogic *_player,
CardZoneLogic *_origZone,
int _numberCards,
bool _revealZone,

View file

@ -3,8 +3,8 @@
#include "../../client/settings/cache_settings.h"
#include "../../game/board/card_drag_item.h"
#include "../../game/board/card_item.h"
#include "../../game/player/player.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../interface/theme_manager.h"
#include <QPainter>

View file

@ -2,8 +2,8 @@
#include "../../game/board/card_drag_item.h"
#include "../../game/board/card_item.h"
#include "../../game/player/player.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../game/zones/pile_zone_logic.h"
#include "view_zone.h"

View file

@ -3,8 +3,8 @@
#include "../../game/board/card_drag_item.h"
#include "../../game/board/card_item.h"
#include "../../game/card_dimensions.h"
#include "../../game/player/player.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../game/zones/stack_zone_logic.h"
#include "../../interface/theme_manager.h"

View file

@ -4,8 +4,8 @@
#include "../../game/board/arrow_item.h"
#include "../../game/board/card_drag_item.h"
#include "../../game/board/card_item.h"
#include "../../game/player/player.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../game/z_values.h"
#include "../../game/zones/table_zone_logic.h"
#include "../../interface/theme_manager.h"

View file

@ -2,8 +2,8 @@
#include "../../game/board/card_drag_item.h"
#include "../../game/board/card_item.h"
#include "../../game/player/player.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../game/zones/view_zone_logic.h"
#include <QBrush>

View file

@ -4,8 +4,8 @@
#include "../../filters/syntax_help.h"
#include "../../game/board/card_item.h"
#include "../../game/game_scene.h"
#include "../../game/player/player.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../game/z_values.h"
#include "../../interface/pixel_map_generator.h"
#include "view_zone.h"
@ -37,7 +37,7 @@ constexpr qreal kMinVisibleWidth = 100.0;
* @param _revealZone if false, the cards will be face down.
* @param _writeableRevealZone whether the player can interact with the revealed cards.
*/
ZoneViewWidget::ZoneViewWidget(Player *_player,
ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
CardZoneLogic *_origZone,
int numberCards,
bool _revealZone,

View file

@ -20,7 +20,7 @@ class QLabel;
class QPushButton;
class CardZone;
class ZoneViewZone;
class Player;
class PlayerLogic;
class CardDatabase;
class QScrollBar;
class GameScene;
@ -65,7 +65,7 @@ private:
bool canBeShuffled;
int extraHeight;
Player *player;
PlayerLogic *player;
bool draggingWindow = false;
QPoint dragStartScreenPos;
@ -108,7 +108,7 @@ private slots:
void expandWindow();
public:
ZoneViewWidget(Player *_player,
ZoneViewWidget(PlayerLogic *_player,
CardZoneLogic *_origZone,
int numberCards = 0,
bool _revealZone = false,
@ -119,7 +119,7 @@ public:
{
return zone;
}
Player *getPlayer() const
PlayerLogic *getPlayer() const
{
return player;
}

View file

@ -10,8 +10,8 @@
#include "../game/game_view.h"
#include "../game/log/message_log_widget.h"
#include "../game/phases_toolbar.h"
#include "../game/player/player.h"
#include "../game/player/player_list_widget.h"
#include "../game/player/player_logic.h"
#include "../game/replay.h"
#include "../interface/card_picture_loader/card_picture_loader.h"
#include "../interface/widgets/cards/card_info_frame_widget.h"
@ -363,7 +363,7 @@ void TabGame::retranslateUi()
cardInfoFrameWidget->retranslateUi();
QMapIterator<int, Player *> i(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> i(game->getPlayerManager()->getPlayers());
while (i.hasNext()) {
i.next().value()->getGraphicsItem()->retranslateUi();
@ -489,7 +489,7 @@ void TabGame::actGameInfo()
void TabGame::actConcede()
{
Player *player = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
PlayerLogic *player = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
if (player == nullptr) {
return;
}
@ -606,9 +606,9 @@ void TabGame::actNextPhaseAction()
void TabGame::actRemoveLocalArrows()
{
QMapIterator<int, Player *> playerIterator(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> playerIterator(game->getPlayerManager()->getPlayers());
while (playerIterator.hasNext()) {
Player *player = playerIterator.next().value();
PlayerLogic *player = playerIterator.next().value();
if (!player->getPlayerInfo()->getLocal()) {
continue;
}
@ -655,14 +655,14 @@ void TabGame::notifyPlayerKicked()
msgBox.exec();
}
Player *TabGame::addPlayer(Player *newPlayer)
PlayerLogic *TabGame::addPlayer(PlayerLogic *newPlayer)
{
QString newPlayerName = "@" + newPlayer->getPlayerInfo()->getName();
addPlayerToAutoCompleteList(newPlayerName);
scene->addPlayer(newPlayer);
connect(newPlayer, &Player::newCardAdded, this, &TabGame::newCardAdded);
connect(newPlayer, &PlayerLogic::newCardAdded, this, &TabGame::newCardAdded);
connect(newPlayer->getPlayerMenu(), &PlayerMenu::cardMenuUpdated, this, &TabGame::setCardMenu);
messageLog->connectToPlayerEventHandler(newPlayer->getPlayerEventHandler());
@ -683,7 +683,7 @@ Player *TabGame::addPlayer(Player *newPlayer)
return newPlayer;
}
void TabGame::addLocalPlayer(Player *newPlayer, int playerId)
void TabGame::addLocalPlayer(PlayerLogic *newPlayer, int playerId)
{
if (game->getGameState()->getClients().size() == 1) {
newPlayer->getPlayerMenu()->setShortcutsActive();
@ -704,7 +704,7 @@ void TabGame::addLocalPlayer(Player *newPlayer, int playerId)
}
}
void TabGame::processPlayerLeave(Player *leavingPlayer)
void TabGame::processPlayerLeave(PlayerLogic *leavingPlayer)
{
QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName();
removePlayerFromAutoCompleteList(playerName);
@ -751,13 +751,13 @@ void TabGame::processMultipleRemotePlayerDeckSelect(QVector<QPair<int, QPair<QSt
}
}
void TabGame::processLocalPlayerDeckSelect(Player *localPlayer, int playerId, ServerInfo_Player playerInfo)
void TabGame::processLocalPlayerDeckSelect(PlayerLogic *localPlayer, int playerId, ServerInfo_Player playerInfo)
{
loadDeckForLocalPlayer(localPlayer, playerId, playerInfo);
processLocalPlayerReady(playerId, playerInfo);
}
void TabGame::loadDeckForLocalPlayer(Player *localPlayer, int playerId, ServerInfo_Player playerInfo)
void TabGame::loadDeckForLocalPlayer(PlayerLogic *localPlayer, int playerId, ServerInfo_Player playerInfo)
{
TabbedDeckViewContainer *deckViewContainer = deckViewContainers.value(playerId);
if (playerInfo.has_deck_list()) {
@ -784,7 +784,7 @@ void TabGame::processLocalPlayerReadyStateChanged(int playerId, bool ready)
deckViewContainers.value(playerId)->playerDeckView->setReadyStart(ready);
}
void TabGame::createZoneForPlayer(Player *newPlayer, int playerId)
void TabGame::createZoneForPlayer(PlayerLogic *newPlayer, int playerId)
{
if (!game->getPlayerManager()->getSpectators().contains(playerId)) {
@ -820,7 +820,7 @@ void TabGame::startGame(bool _resuming)
mainWidget->setCurrentWidget(gamePlayAreaWidget);
if (!_resuming) {
QMapIterator<int, Player *> playerIterator(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> playerIterator(game->getPlayerManager()->getPlayers());
while (playerIterator.hasNext()) {
playerIterator.next().value()->setGameStarted();
}
@ -863,15 +863,15 @@ void TabGame::closeGame()
gameMenu->addAction(aLeaveGame);
}
Player *TabGame::setActivePlayer(int id)
PlayerLogic *TabGame::setActivePlayer(int id)
{
Player *player = game->getPlayerManager()->getPlayer(id);
PlayerLogic *player = game->getPlayerManager()->getPlayer(id);
if (!player) {
return nullptr;
}
playerListWidget->setActivePlayer(id);
QMapIterator<int, Player *> i(game->getPlayerManager()->getPlayers());
QMapIterator<int, PlayerLogic *> i(game->getPlayerManager()->getPlayers());
while (i.hasNext()) {
i.next();
if (i.value() == player) {

View file

@ -11,7 +11,7 @@
#include "../game/abstract_game.h"
#include "../game/log/message_log_widget.h"
#include "../game/player/player.h"
#include "../game/player/player_logic.h"
#include "../interface/widgets/menus/tearoff_menu.h"
#include "../interface/widgets/replay/replay_manager.h"
#include "tab.h"
@ -99,21 +99,21 @@ private:
QMap<QDockWidget *, DockActions> dockToActions;
Player *addPlayer(Player *newPlayer);
void addLocalPlayer(Player *newPlayer, int playerId);
PlayerLogic *addPlayer(PlayerLogic *newPlayer);
void addLocalPlayer(PlayerLogic *newPlayer, int playerId);
void processRemotePlayerDeckSelect(QString deckList, int playerId, QString playerName);
void processMultipleRemotePlayerDeckSelect(QVector<QPair<int, QPair<QString, QString>>> playerIdDeckMap);
void processLocalPlayerDeckSelect(Player *localPlayer, int playerId, ServerInfo_Player playerInfo);
void loadDeckForLocalPlayer(Player *localPlayer, int playerId, ServerInfo_Player playerInfo);
void processLocalPlayerDeckSelect(PlayerLogic *localPlayer, int playerId, ServerInfo_Player playerInfo);
void loadDeckForLocalPlayer(PlayerLogic *localPlayer, int playerId, ServerInfo_Player playerInfo);
void processLocalPlayerReady(int playerId, ServerInfo_Player playerInfo);
void createZoneForPlayer(Player *newPlayer, int playerId);
void createZoneForPlayer(PlayerLogic *newPlayer, int playerId);
void startGame(bool resuming);
void stopGame();
void closeGame();
bool leaveGame();
Player *setActivePlayer(int id);
PlayerLogic *setActivePlayer(int id);
void setActivePhase(int phase);
void createMenuItems();
void createReplayMenuItems();
@ -163,7 +163,7 @@ private slots:
void actCompleterChanged();
void notifyPlayerJoin(QString playerName);
void notifyPlayerKicked();
void processPlayerLeave(Player *leavingPlayer);
void processPlayerLeave(PlayerLogic *leavingPlayer);
void actResetLayout();
void hideEvent(QHideEvent *event) override;