Adjust to rebase.

Took 28 minutes

Took 7 seconds

Took 2 minutes

Took 8 minutes

Took 13 seconds
This commit is contained in:
Lukas Brübach 2026-06-09 09:26:53 +02:00 committed by DawnFire42
parent 9b030a3d6b
commit 8ca693ef70
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
16 changed files with 50 additions and 48 deletions

View file

@ -87,7 +87,7 @@ set(cockatrice_SOURCES
src/game_graphics/log/message_log_widget.cpp
src/game/phase.cpp
src/game_graphics/phases_toolbar.cpp
src/game_graphics/player/menu/card_menu.
src/game_graphics/player/menu/card_menu.cpp
src/game_graphics/player/menu/command_zone_menu.cpp
src/game_graphics/player/menu/custom_zone_menu.cpp
src/game_graphics/player/menu/grave_menu.cpp
@ -112,7 +112,7 @@ set(cockatrice_SOURCES
src/game_graphics/player/player_target.cpp
src/game/replay.cpp
src/game/zones/card_zone_logic.cpp
src/game/zones/command_zone.cpp
src/game_graphics/zones/command_zone.cpp
src/game/zones/command_zone_logic.cpp
src/game/zones/hand_zone_logic.cpp
src/game/zones/pile_zone_logic.cpp

View file

@ -7,7 +7,6 @@
#include "../../game_graphics/zones/table_zone.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../../interface/widgets/utility/get_text_with_max.h"
#include "../zones/view_zone_logic.h"
#include <libcockatrice/card/database/card_database_manager.h>
@ -1627,14 +1626,13 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
void PlayerActions::playSelectedCards(QList<CardItem *> selectedCards, const bool faceDown)
{
playSelectedCardsImpl(faceDown, nullptr);
playSelectedCardsImpl(selectedCards, faceDown, nullptr);
}
void PlayerActions::playSelectedCardsImpl(bool faceDown,
void PlayerActions::playSelectedCardsImpl(QList<CardItem *> selectedCards,
bool faceDown,
const std::function<void(CardItem *, const QString &)> &postPlayCallback)
{
QList<CardItem *> selectedCards = player->getGameScene()->selectedCards();
// CardIds will get shuffled downwards when cards leave the deck.
// We need to iterate through the cards in reverse order so cardIds don't get changed out from under us as we play
// out the cards one-by-one.
@ -1652,9 +1650,9 @@ void PlayerActions::playSelectedCardsImpl(bool faceDown,
}
}
void PlayerActions::actPlayAndIncreaseTax()
void PlayerActions::actPlayAndIncreaseTax(QList<CardItem *> selectedCards)
{
playSelectedCardsImpl(false, [this](CardItem * /*card*/, const QString &originalZone) {
playSelectedCardsImpl(selectedCards, false, [this](CardItem * /*card*/, const QString &originalZone) {
if (originalZone == ZoneNames::COMMAND) {
AbstractCounter *ctr = player->getCounterWidget(CounterIds::CommanderTax);
if (ctr && ctr->isActive()) {
@ -1664,9 +1662,9 @@ void PlayerActions::actPlayAndIncreaseTax()
});
}
void PlayerActions::actPlayAndIncreasePartnerTax()
void PlayerActions::actPlayAndIncreasePartnerTax(QList<CardItem *> selectedCards)
{
playSelectedCardsImpl(false, [this](CardItem * /*card*/, const QString &originalZone) {
playSelectedCardsImpl(selectedCards, false, [this](CardItem * /*card*/, const QString &originalZone) {
if (originalZone == ZoneNames::COMMAND) {
AbstractCounter *ctr = player->getCounterWidget(CounterIds::PartnerTax);
if (ctr && ctr->isActive()) {

View file

@ -128,9 +128,9 @@ public slots:
void actPlay(QList<CardItem *> selectedCards);
void actPlayFacedown(QList<CardItem *> selectedCards);
/** @brief Plays the selected card and increments the primary commander tax counter. */
void actPlayAndIncreaseTax();
void actPlayAndIncreaseTax(QList<CardItem *> selectedCards);
/** @brief Plays the selected card and increments the partner commander tax counter. */
void actPlayAndIncreasePartnerTax();
void actPlayAndIncreasePartnerTax(QList<CardItem *> selectedCards);
/** @brief Modifies a tax counter by delta if it is active. */
void actModifyTaxCounter(int counterId, int delta);
/** @brief Toggles a tax counter's active state (only if inactive or value is 0). */
@ -257,10 +257,14 @@ private:
/**
* @brief Shared implementation for playing selected cards with an optional post-play callback.
* @param selectedCards
* @param selectedCards
* @param selectedCards
* @param postPlayCallback Called after each card is played, receiving the card and its *original* zone name
* (captured before playCard, since playCard sends a move command that may change the card's zone).
*/
void playSelectedCardsImpl(bool faceDown,
void playSelectedCardsImpl(QList<CardItem *> selectedCards,
bool faceDown,
const std::function<void(CardItem *, const QString &)> &postPlayCallback = nullptr);
void cmdSetTopCard(Command_MoveCard &cmd);

View file

@ -4,7 +4,6 @@
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/zones/view_zone.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../board/abstract_counter.h"
#include "../board/arrow_data.h"
#include "../board/card_list.h"
#include "player_actions.h"
@ -287,11 +286,12 @@ void PlayerEventHandler::eventSetCounterActive(const Event_SetCounterActive &eve
}
state->setActive(event.active());
AbstractCounter *widget = player->getGraphicsItem()->getCounterWidget(event.counter_id());
// TODO: The counters data should emit this and the widget hook up to it. Don't reach into graphics like this.
/*AbstractCounter *widget = player->getGraphicsItem()->getCounterWidget(event.counter_id());
if (widget) {
widget->setActive(event.active());
emit player->rearrangeCounters();
}
}*/
}
void PlayerEventHandler::eventDelCounter(const Event_DelCounter &event)

View file

@ -2,9 +2,11 @@
#include "../../game_graphics/board/arrow_item.h"
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/board/commander_tax_counter.h"
#include "../../game_graphics/board/counter_general.h"
#include "../../game_graphics/game_scene.h"
#include "../../game_graphics/player/player_target.h"
#include "../../game_graphics/zones/command_zone.h"
#include "../../game_graphics/zones/hand_zone.h"
#include "../../game_graphics/zones/pile_zone.h"
#include "../../game_graphics/zones/stack_zone.h"
@ -12,10 +14,6 @@
#include "../../interface/theme_manager.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../board/card_list.h"
#include "../board/commander_tax_counter.h"
#include "../board/counter_general.h"
#include "../game_scene.h"
#include "../zones/command_zone.h"
#include "player_actions.h"
#include <QDebug>
@ -320,7 +318,9 @@ CounterState *PlayerLogic::getLifeCounter() const
AbstractCounter *PlayerLogic::getCounterWidget(int counterId) const
{
return graphicsItem->getCounterWidget(counterId);
Q_UNUSED(counterId);
return nullptr;
// TODO: Do not reach into graphics like this return graphicsItem->getCounterWidget(counterId);
}
bool PlayerLogic::clearCardsToDelete()

View file

@ -26,6 +26,7 @@
#include <libcockatrice/filters/filter_string.h>
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
#include <libcockatrice/protocol/pb/game_event.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
#include <libcockatrice/utility/zone_names.h>
inline Q_LOGGING_CATEGORY(PlayerLog, "player");

View file

@ -1,6 +1,6 @@
#include "command_zone_logic.h"
#include "../board/card_item.h"
#include "../../game_graphics/board/card_item.h"
#include "card_zone_algorithms.h"
CommandZoneLogic::CommandZoneLogic(PlayerLogic *_player,

View file

@ -1,6 +1,6 @@
#include "commander_tax_counter.h"
#include "counter_state.h"
#include "../../game/board/counter_state.h"
#include "translate_counter_name.h"
#include <QColor>

View file

@ -83,6 +83,8 @@ CardMenu::CardMenu(PlayerGraphicsItem *_player, const CardItem *_card, bool _sho
aUnattach = makeAction(this, [actions, sel]() { actions->actUnattach(sel()); });
aSetAnnotation = makeAction(this, [actions, sel]() { actions->actRequestSetAnnotationDialog(sel()); });
aPlay = makeAction(this, [actions, sel]() { actions->actPlay(sel()); });
aPlayAndIncreaseTax = makeAction(this, [actions, sel]() { actions->actPlayAndIncreaseTax(sel()); });
aPlayAndIncreasePartnerTax = makeAction(this, [actions, sel]() { actions->actPlayAndIncreasePartnerTax(sel()); });
aPlayFacedown = makeAction(this, [actions, sel]() { actions->actPlayFacedown(sel()); });
aHide = makeAction(this, [actions, sel]() { actions->actHide(sel()); });
aReduceLifeByPower = makeAction(this, [actions, sel]() { actions->actReduceLifeByPower(sel()); });
@ -94,12 +96,6 @@ CardMenu::CardMenu(PlayerGraphicsItem *_player, const CardItem *_card, bool _sho
aSelectRow = new QAction(this);
aSelectColumn = new QAction(this);
aPlayAndIncreaseTax = new QAction(this);
connect(aPlayAndIncreaseTax, &QAction::triggered, playerActions, &PlayerActions::actPlayAndIncreaseTax);
aPlayAndIncreasePartnerTax = new QAction(this);
connect(aPlayAndIncreasePartnerTax, &QAction::triggered, playerActions,
&PlayerActions::actPlayAndIncreasePartnerTax);
connect(aAttach, &QAction::triggered, actions, &PlayerActions::actAttach);
connect(aDrawArrow, &QAction::triggered, actions, &PlayerActions::actDrawArrow);
connect(aSelectAll, &QAction::triggered, actions, &PlayerActions::actSelectAll);

View file

@ -2,11 +2,11 @@
#include "../../../client/settings/cache_settings.h"
#include "../../board/abstract_counter.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../game_scene.h"
#include "../../zones/command_zone.h"
#include "../player_actions.h"
#include "../player_graphics_item.h"
#include "../player_logic.h"
#include <libcockatrice/utility/counter_ids.h>
#include <libcockatrice/utility/zone_names.h>
@ -21,7 +21,7 @@ CommandZoneMenu::CommandZoneMenu(PlayerLogic *_player, QMenu *playerMenu) : QMen
aViewZone = new QAction(this);
connect(aViewZone, &QAction::triggered, this,
[this]() { player->getGameScene()->toggleZoneView(player, ZoneNames::COMMAND, -1); });
[this]() { emit player->requestZoneViewToggle(player, ZoneNames::COMMAND, -1, false); });
if (player->getPlayerInfo()->getLocalOrJudge()) {
addAction(aViewZone);
@ -106,10 +106,11 @@ void CommandZoneMenu::retranslateUi()
void CommandZoneMenu::actToggleMinimized()
{
CommandZone *zone = player->getGraphicsItem()->getCommandZoneGraphicsItem();
// TODO
/*CommandZone *zone = player->getGraphicsItem()->getCommandZoneGraphicsItem();
if (zone) {
zone->toggleMinimized();
}
}*/
}
void CommandZoneMenu::updateTaxCounterActionStates()

View file

@ -33,14 +33,15 @@ PlayerMenu::PlayerMenu(PlayerGraphicsItem *_player) : QObject(_player), player(_
if (player->getLogic()->getPlayerInfo()->getLocalOrJudge()) {
sideboardMenu = addManagedMenu<SideboardMenu>(player, playerMenu);
commandZoneMenu = addManagedMenu<CommandZoneMenu>(player, playerMenu);
// TODO
/*commandZoneMenu = addManagedMenu<CommandZoneMenu>(player, playerMenu);
auto updateCommandZoneMenuVisibility = [this](bool has) {
if (commandZoneMenu) {
commandZoneMenu->menuAction()->setVisible(has);
}
};
connect(player, &PlayerLogic::commandZoneSupportChanged, this, updateCommandZoneMenuVisibility);
updateCommandZoneMenuVisibility(player->hasServerCommandZone());
updateCommandZoneMenuVisibility(player->hasServerCommandZone());*/
customZonesMenu = addManagedMenu<CustomZoneMenu>(player);
playerMenu->addSeparator();

View file

@ -8,7 +8,7 @@
#define COCKATRICE_PLAYER_MENU_H
#include "../../../interface/widgets/menus/tearoff_menu.h"
#include "../player_logic.h"
#include "../../game/player/player_logic.h"
#include "command_zone_menu.h"
#include "custom_zone_menu.h"
#include "grave_menu.h"

View file

@ -6,6 +6,8 @@
#include "../board/commander_tax_counter.h"
#include "../board/counter_general.h"
#include "../hand_counter.h"
#include "../z_values.h"
#include "../zones/command_zone.h"
#include "../zones/hand_zone.h"
#include "../zones/pile_zone.h"
#include "../zones/stack_zone.h"
@ -14,9 +16,6 @@
#include "player_dialogs.h"
#include <QGraphicsView>
#include "../z_values.h"
#include "../zones/command_zone.h"
#include <libcockatrice/utility/counter_ids.h>
PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
@ -66,6 +65,7 @@ PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
connect(player, &PlayerLogic::addViewCustomZoneActionToCustomZoneMenu, this,
&PlayerGraphicsItem::onCustomZoneAdded);
connect(player, &PlayerLogic::commandZoneSupportChanged, this, &PlayerGraphicsItem::setCommandZoneVisible);
playerMenu->setMenusForGraphicItems();

View file

@ -1,14 +1,14 @@
#include "command_zone.h"
#include "../../client/settings/cache_settings.h"
#include "../../game_graphics/zones/select_zone.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_logic.h"
#include "../../interface/theme_manager.h"
#include "../board/card_drag_item.h"
#include "../board/card_item.h"
#include "../board/commander_tax_counter.h"
#include "../player/player_actions.h"
#include "../player/player_logic.h"
#include "../z_values.h"
#include "select_zone.h"
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
@ -140,7 +140,8 @@ void CommandZone::reorganizeCards()
void CommandZone::rearrangeTaxCounters()
{
bool commandZoneVisible = isVisible();
// TODO
/*bool commandZoneVisible = isVisible();
int activeTaxCounterCount = 0;
auto *graphicsItem = getLogic()->getPlayer()->getGraphicsItem();
@ -162,7 +163,7 @@ void CommandZone::rearrangeTaxCounters()
int minHeight = activeTaxCounterCount * (TaxCounterSizes::TAX_COUNTER_SIZE + TaxCounterSizes::TAX_COUNTER_MARGIN) +
TaxCounterSizes::TAX_COUNTER_MARGIN;
setMinimumHeight(minHeight);
setMinimumHeight(minHeight);*/
}
void CommandZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)

View file

@ -7,9 +7,9 @@
#ifndef COCKATRICE_COMMAND_ZONE_H
#define COCKATRICE_COMMAND_ZONE_H
#include "../../game_graphics/zones/select_zone.h"
#include "../../game/zones/command_zone_logic.h"
#include "../card_dimensions.h"
#include "command_zone_logic.h"
#include "select_zone.h"
#include <QLoggingCategory>