mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
I tried enums, was more annoying. Will probably look again later.
This commit is contained in:
parent
c9d5d5609c
commit
c24217e4b0
15 changed files with 167 additions and 531 deletions
|
|
@ -673,12 +673,12 @@ void TabDeckEditor::retranslateUi()
|
|||
deckMenu->setTitle(tr("&Deck Editor"));
|
||||
|
||||
cardInfoDock->setWindowTitle(tr("Card Info"));
|
||||
deckDock->setWindowTitle(tr("Deck"));
|
||||
deckDock->setWindowTitle(tr(ZONE_DECK));
|
||||
filterDock->setWindowTitle(tr("Filters"));
|
||||
|
||||
viewMenu->setTitle(tr("&View"));
|
||||
cardInfoDockMenu->setTitle(tr("Card Info"));
|
||||
deckDockMenu->setTitle(tr("Deck"));
|
||||
deckDockMenu->setTitle(tr(ZONE_DECK));
|
||||
filterDockMenu->setTitle(tr("Filters"));
|
||||
|
||||
aCardInfoDockVisible->setText(tr("Visible"));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "phases_toolbar.h"
|
||||
|
||||
#include "../common/card_zones.h"
|
||||
|
||||
#include "pb/command_draw_cards.pb.h"
|
||||
#include "pb/command_next_turn.pb.h"
|
||||
#include "pb/command_set_active_phase.pb.h"
|
||||
|
|
@ -259,7 +261,7 @@ void PhasesToolbar::actNextTurn()
|
|||
void PhasesToolbar::actUntapAll()
|
||||
{
|
||||
Command_SetCardAttr cmd;
|
||||
cmd.set_zone("table");
|
||||
cmd.set_zone(ZONE_TABLE);
|
||||
cmd.set_attribute(AttrTapped);
|
||||
cmd.set_attr_value("0");
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <QNetworkRequest>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrlQuery>
|
||||
#include "../common/card_zones.h"
|
||||
|
||||
DeckStatsInterface::DeckStatsInterface(CardDatabase &_cardDatabase, QObject *parent)
|
||||
: QObject(parent), cardDatabase(_cardDatabase)
|
||||
|
|
@ -50,7 +51,7 @@ void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
|||
|
||||
QUrl params;
|
||||
QUrlQuery urlQuery;
|
||||
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
urlQuery.addQueryItem(ZONE_DECK, deckWithoutTokens.writeToString_Plain());
|
||||
urlQuery.addQueryItem("decktitle", deck->getName());
|
||||
params.setQuery(urlQuery);
|
||||
data->append(params.query(QUrl::EncodeReserved).toUtf8());
|
||||
|
|
|
|||
|
|
@ -237,15 +237,15 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
PlayerTarget *targetPlayer = qgraphicsitem_cast<PlayerTarget *>(targetItem);
|
||||
cmd.set_target_player_id(targetPlayer->getOwner()->getId());
|
||||
}
|
||||
if (startZone->getName().compare("hand") == 0) {
|
||||
if (startZone->getName().compare(ZONE_HAND) == 0) {
|
||||
startCard->playCard(false);
|
||||
CardInfoPtr ci = startCard->getInfo();
|
||||
if (ci && (((!SettingsCache::instance().getPlayToStack() && ci->getTableRow() == 3) ||
|
||||
((SettingsCache::instance().getPlayToStack() && ci->getTableRow() != 0) &&
|
||||
startCard->getZone()->getName().toStdString() != "stack"))))
|
||||
cmd.set_start_zone("stack");
|
||||
startCard->getZone()->getName().toStdString() != ZONE_STACK))))
|
||||
cmd.set_start_zone(ZONE_STACK);
|
||||
else
|
||||
cmd.set_start_zone(SettingsCache::instance().getPlayToStack() ? "stack" : "table");
|
||||
cmd.set_start_zone(SettingsCache::instance().getPlayToStack() ? ZONE_STACK : ZONE_TABLE);
|
||||
}
|
||||
player->sendGameCommand(cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,9 +155,9 @@ void GameScene::toggleZoneView(Player *player, const QString &zoneName, int numb
|
|||
zoneViews.append(item);
|
||||
connect(item, SIGNAL(closePressed(ZoneViewWidget *)), this, SLOT(removeZoneView(ZoneViewWidget *)));
|
||||
addItem(item);
|
||||
if (zoneName == "grave") {
|
||||
if (zoneName == ZONE_GRAVEYARD) {
|
||||
item->setPos(360, 100);
|
||||
} else if (zoneName == "rfg") {
|
||||
} else if (zoneName == ZONE_EXILE) {
|
||||
item->setPos(380, 120);
|
||||
} else {
|
||||
item->setPos(340, 80);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
qreal avatarMargin = (counterAreaWidth + CARD_HEIGHT + 15 - playerTarget->boundingRect().width()) / 2.0;
|
||||
playerTarget->setPos(QPointF(avatarMargin, avatarMargin));
|
||||
|
||||
auto *_deck = new PileZone(this, "deck", true, false, playerArea);
|
||||
auto *_deck = new PileZone(this, ZONE_DECK, true, false, playerArea);
|
||||
QPointF base = QPointF(counterAreaWidth + (CARD_HEIGHT - CARD_WIDTH + 15) / 2.0,
|
||||
10 + playerTarget->boundingRect().height() + 5 - (CARD_HEIGHT - CARD_WIDTH) / 2.0);
|
||||
_deck->setPos(base);
|
||||
|
|
@ -140,13 +140,13 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
handCounter->setPos(base + QPointF(0, h + 10));
|
||||
qreal h2 = handCounter->boundingRect().height();
|
||||
|
||||
PileZone *grave = new PileZone(this, "grave", false, true, playerArea);
|
||||
PileZone *grave = new PileZone(this, ZONE_GRAVEYARD, false, true, playerArea);
|
||||
grave->setPos(base + QPointF(0, h + h2 + 10));
|
||||
|
||||
PileZone *rfg = new PileZone(this, "rfg", false, true, playerArea);
|
||||
PileZone *rfg = new PileZone(this, ZONE_EXILE, false, true, playerArea);
|
||||
rfg->setPos(base + QPointF(0, 2 * h + h2 + 10));
|
||||
|
||||
PileZone *sb = new PileZone(this, "sb", false, false, playerArea);
|
||||
PileZone *sb = new PileZone(this, ZONE_SIDEBOARD, false, false, playerArea);
|
||||
sb->setVisible(false);
|
||||
|
||||
table = new TableZone(this, this);
|
||||
|
|
@ -168,13 +168,13 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
|
||||
if (local || judge) {
|
||||
aMoveHandToTopLibrary = new QAction(this);
|
||||
aMoveHandToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
||||
aMoveHandToTopLibrary->setData(QList<QVariant>() << ZONE_DECK << 0);
|
||||
aMoveHandToBottomLibrary = new QAction(this);
|
||||
aMoveHandToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
||||
aMoveHandToBottomLibrary->setData(QList<QVariant>() << ZONE_DECK << -1);
|
||||
aMoveHandToGrave = new QAction(this);
|
||||
aMoveHandToGrave->setData(QList<QVariant>() << "grave" << 0);
|
||||
aMoveHandToGrave->setData(QList<QVariant>() << ZONE_GRAVEYARD << 0);
|
||||
aMoveHandToRfg = new QAction(this);
|
||||
aMoveHandToRfg->setData(QList<QVariant>() << "rfg" << 0);
|
||||
aMoveHandToRfg->setData(QList<QVariant>() << ZONE_EXILE << 0);
|
||||
|
||||
connect(aMoveHandToTopLibrary, SIGNAL(triggered()), hand, SLOT(moveAllToZone()));
|
||||
connect(aMoveHandToBottomLibrary, SIGNAL(triggered()), hand, SLOT(moveAllToZone()));
|
||||
|
|
@ -182,13 +182,13 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
connect(aMoveHandToRfg, SIGNAL(triggered()), hand, SLOT(moveAllToZone()));
|
||||
|
||||
aMoveGraveToTopLibrary = new QAction(this);
|
||||
aMoveGraveToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
||||
aMoveGraveToTopLibrary->setData(QList<QVariant>() << ZONE_DECK << 0);
|
||||
aMoveGraveToBottomLibrary = new QAction(this);
|
||||
aMoveGraveToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
||||
aMoveGraveToBottomLibrary->setData(QList<QVariant>() << ZONE_DECK << -1);
|
||||
aMoveGraveToHand = new QAction(this);
|
||||
aMoveGraveToHand->setData(QList<QVariant>() << "hand" << 0);
|
||||
aMoveGraveToHand->setData(QList<QVariant>() << ZONE_HAND << 0);
|
||||
aMoveGraveToRfg = new QAction(this);
|
||||
aMoveGraveToRfg->setData(QList<QVariant>() << "rfg" << 0);
|
||||
aMoveGraveToRfg->setData(QList<QVariant>() << ZONE_EXILE << 0);
|
||||
|
||||
connect(aMoveGraveToTopLibrary, SIGNAL(triggered()), grave, SLOT(moveAllToZone()));
|
||||
connect(aMoveGraveToBottomLibrary, SIGNAL(triggered()), grave, SLOT(moveAllToZone()));
|
||||
|
|
@ -196,13 +196,13 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
connect(aMoveGraveToRfg, SIGNAL(triggered()), grave, SLOT(moveAllToZone()));
|
||||
|
||||
aMoveRfgToTopLibrary = new QAction(this);
|
||||
aMoveRfgToTopLibrary->setData(QList<QVariant>() << "deck" << 0);
|
||||
aMoveRfgToTopLibrary->setData(QList<QVariant>() << ZONE_DECK << 0);
|
||||
aMoveRfgToBottomLibrary = new QAction(this);
|
||||
aMoveRfgToBottomLibrary->setData(QList<QVariant>() << "deck" << -1);
|
||||
aMoveRfgToBottomLibrary->setData(QList<QVariant>() << ZONE_DECK << -1);
|
||||
aMoveRfgToHand = new QAction(this);
|
||||
aMoveRfgToHand->setData(QList<QVariant>() << "hand" << 0);
|
||||
aMoveRfgToHand->setData(QList<QVariant>() << ZONE_HAND << 0);
|
||||
aMoveRfgToGrave = new QAction(this);
|
||||
aMoveRfgToGrave->setData(QList<QVariant>() << "grave" << 0);
|
||||
aMoveRfgToGrave->setData(QList<QVariant>() << ZONE_GRAVEYARD << 0);
|
||||
|
||||
connect(aMoveRfgToTopLibrary, SIGNAL(triggered()), rfg, SLOT(moveAllToZone()));
|
||||
connect(aMoveRfgToBottomLibrary, SIGNAL(triggered()), rfg, SLOT(moveAllToZone()));
|
||||
|
|
@ -649,25 +649,25 @@ void Player::playerListActionTriggered()
|
|||
}
|
||||
|
||||
if (menu == mRevealLibrary || menu == mLendLibrary) {
|
||||
cmd.set_zone_name("deck");
|
||||
cmd.set_zone_name(ZONE_DECK);
|
||||
cmd.set_grant_write_access(menu == mLendLibrary);
|
||||
} else if (menu == mRevealTopCard) {
|
||||
int deckSize = zones.value("deck")->getCards().size();
|
||||
int deckSize = zones.value(ZONE_DECK)->getCards().size();
|
||||
bool ok;
|
||||
int number = QInputDialog::getInt(game, tr("Reveal top cards of library"),
|
||||
tr("Number of cards: (max. %1)").arg(deckSize), defaultNumberTopCards, 1,
|
||||
deckSize, 1, &ok);
|
||||
if (ok) {
|
||||
cmd.set_zone_name("deck");
|
||||
cmd.set_zone_name(ZONE_DECK);
|
||||
cmd.set_top_cards(number);
|
||||
// backward compatibility: servers before #1051 only permits to reveal the first card
|
||||
cmd.add_card_id(0);
|
||||
}
|
||||
|
||||
} else if (menu == mRevealHand) {
|
||||
cmd.set_zone_name("hand");
|
||||
cmd.set_zone_name(ZONE_HAND);
|
||||
} else if (menu == mRevealRandomHandCard) {
|
||||
cmd.set_zone_name("hand");
|
||||
cmd.set_zone_name(ZONE_HAND);
|
||||
cmd.add_card_id(RANDOM_CARD_FROM_ZONE);
|
||||
} else {
|
||||
return;
|
||||
|
|
@ -1094,31 +1094,31 @@ void Player::setDeck(const DeckLoader &_deck)
|
|||
|
||||
void Player::actViewLibrary()
|
||||
{
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "deck", -1);
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, ZONE_DECK, -1);
|
||||
}
|
||||
|
||||
void Player::actViewHand()
|
||||
{
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "hand", -1);
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, ZONE_HAND, -1);
|
||||
}
|
||||
|
||||
void Player::actViewTopCards()
|
||||
{
|
||||
int deckSize = zones.value("deck")->getCards().size();
|
||||
int deckSize = zones.value(ZONE_DECK)->getCards().size();
|
||||
bool ok;
|
||||
int number =
|
||||
QInputDialog::getInt(game, tr("View top cards of library"), tr("Number of cards: (max. %1)").arg(deckSize),
|
||||
defaultNumberTopCards, 1, deckSize, 1, &ok);
|
||||
if (ok) {
|
||||
defaultNumberTopCards = number;
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "deck", number);
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, ZONE_DECK, number);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::actAlwaysRevealTopCard()
|
||||
{
|
||||
Command_ChangeZoneProperties cmd;
|
||||
cmd.set_zone_name("deck");
|
||||
cmd.set_zone_name(ZONE_DECK);
|
||||
cmd.set_always_reveal_top_card(aAlwaysRevealTopCard->isChecked());
|
||||
|
||||
sendGameCommand(cmd);
|
||||
|
|
@ -1127,7 +1127,7 @@ void Player::actAlwaysRevealTopCard()
|
|||
void Player::actAlwaysLookAtTopCard()
|
||||
{
|
||||
Command_ChangeZoneProperties cmd;
|
||||
cmd.set_zone_name("deck");
|
||||
cmd.set_zone_name(ZONE_DECK);
|
||||
cmd.set_always_look_at_top_card(aAlwaysLookAtTopCard->isChecked());
|
||||
|
||||
sendGameCommand(cmd);
|
||||
|
|
@ -1140,7 +1140,7 @@ void Player::actOpenDeckInDeckEditor()
|
|||
|
||||
void Player::actViewGraveyard()
|
||||
{
|
||||
dynamic_cast<GameScene *>(scene())->toggleZoneView(this, "grave", -1);
|
||||
dynamic_cast<GameScene *>(scene())->toggleZoneView(this, ZONE_GRAVEYARD, -1);
|
||||
}
|
||||
|
||||
void Player::actRevealRandomGraveyardCard()
|
||||
|
|
@ -1151,19 +1151,19 @@ void Player::actRevealRandomGraveyardCard()
|
|||
if (otherPlayerId != -1) {
|
||||
cmd.set_player_id(otherPlayerId);
|
||||
}
|
||||
cmd.set_zone_name("grave");
|
||||
cmd.set_zone_name(ZONE_GRAVEYARD);
|
||||
cmd.add_card_id(RANDOM_CARD_FROM_ZONE);
|
||||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void Player::actViewRfg()
|
||||
{
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "rfg", -1);
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, ZONE_EXILE, -1);
|
||||
}
|
||||
|
||||
void Player::actViewSideboard()
|
||||
{
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, "sb", -1);
|
||||
static_cast<GameScene *>(scene())->toggleZoneView(this, ZONE_SIDEBOARD, -1);
|
||||
}
|
||||
|
||||
void Player::actShuffle()
|
||||
|
|
@ -1181,8 +1181,8 @@ void Player::actDrawCard()
|
|||
void Player::actMulligan()
|
||||
{
|
||||
int startSize = SettingsCache::instance().getStartingHandSize();
|
||||
int handSize = zones.value("hand")->getCards().size();
|
||||
int deckSize = zones.value("deck")->getCards().size() + handSize; // hand is shuffled back into the deck
|
||||
int handSize = zones.value(ZONE_HAND)->getCards().size();
|
||||
int deckSize = zones.value(ZONE_DECK)->getCards().size() + handSize; // hand is shuffled back into the deck
|
||||
bool ok;
|
||||
int number = QInputDialog::getInt(game, tr("Draw hand"),
|
||||
tr("Number of cards: (max. %1)").arg(deckSize) + '\n' +
|
||||
|
|
@ -1208,7 +1208,7 @@ void Player::actMulligan()
|
|||
|
||||
void Player::actDrawCards()
|
||||
{
|
||||
int deckSize = zones.value("deck")->getCards().size();
|
||||
int deckSize = zones.value(ZONE_DECK)->getCards().size();
|
||||
bool ok;
|
||||
int number = QInputDialog::getInt(game, tr("Draw cards"), tr("Number of cards: (max. %1)").arg(deckSize),
|
||||
defaultNumberTopCards, 1, deckSize, 1, &ok);
|
||||
|
|
@ -1227,7 +1227,7 @@ void Player::actUndoDraw()
|
|||
|
||||
void Player::cmdSetTopCard(Command_MoveCard &cmd)
|
||||
{
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
auto *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||
cardToMove->set_card_id(0);
|
||||
cmd.set_target_player_id(getId());
|
||||
|
|
@ -1235,9 +1235,9 @@ void Player::cmdSetTopCard(Command_MoveCard &cmd)
|
|||
|
||||
void Player::cmdSetBottomCard(Command_MoveCard &cmd)
|
||||
{
|
||||
CardZone *zone = zones.value("deck");
|
||||
CardZone *zone = zones.value(ZONE_DECK);
|
||||
int lastCard = zone->getCards().size() - 1;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
auto *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||
cardToMove->set_card_id(lastCard);
|
||||
cmd.set_target_player_id(getId());
|
||||
|
|
@ -1245,13 +1245,13 @@ void Player::cmdSetBottomCard(Command_MoveCard &cmd)
|
|||
|
||||
void Player::actMoveTopCardToGrave()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetTopCard(cmd);
|
||||
cmd.set_target_zone("grave");
|
||||
cmd.set_target_zone(ZONE_GRAVEYARD);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1260,13 +1260,13 @@ void Player::actMoveTopCardToGrave()
|
|||
|
||||
void Player::actMoveTopCardToExile()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetTopCard(cmd);
|
||||
cmd.set_target_zone("rfg");
|
||||
cmd.set_target_zone(ZONE_EXILE);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1275,7 +1275,7 @@ void Player::actMoveTopCardToExile()
|
|||
|
||||
void Player::actMoveTopCardsToGrave()
|
||||
{
|
||||
const int maxCards = zones.value("deck")->getCards().size();
|
||||
const int maxCards = zones.value(ZONE_DECK)->getCards().size();
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1292,9 +1292,9 @@ void Player::actMoveTopCardsToGrave()
|
|||
defaultNumberTopCards = number;
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("grave");
|
||||
cmd.set_target_zone(ZONE_GRAVEYARD);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1307,7 +1307,7 @@ void Player::actMoveTopCardsToGrave()
|
|||
|
||||
void Player::actMoveTopCardsToExile()
|
||||
{
|
||||
const int maxCards = zones.value("deck")->getCards().size();
|
||||
const int maxCards = zones.value(ZONE_DECK)->getCards().size();
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1324,9 +1324,9 @@ void Player::actMoveTopCardsToExile()
|
|||
defaultNumberTopCards = number;
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("rfg");
|
||||
cmd.set_target_zone(ZONE_EXILE);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1349,7 +1349,7 @@ void Player::actMoveTopCardsUntil()
|
|||
previousMovingCardsUntilExpr = dlg.getExpr();
|
||||
previousMovingCardsUntilNumberOfHits = dlg.getNumberOfHits();
|
||||
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
stopMoveTopCardsUntil();
|
||||
} else {
|
||||
movingCardsUntilFilter = FilterString(previousMovingCardsUntilExpr);
|
||||
|
|
@ -1362,7 +1362,7 @@ void Player::actMoveTopCardsUntil()
|
|||
void Player::moveOneCardUntil(const CardInfoPtr card)
|
||||
{
|
||||
moveTopCardTimer->stop();
|
||||
if (zones.value("deck")->getCards().empty() || card.isNull()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty() || card.isNull()) {
|
||||
stopMoveTopCardsUntil();
|
||||
} else if (movingCardsUntilFilter.check(card)) {
|
||||
--movingCardsUntilCounter;
|
||||
|
|
@ -1388,13 +1388,13 @@ void Player::stopMoveTopCardsUntil()
|
|||
|
||||
void Player::actMoveTopCardToBottom()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetTopCard(cmd);
|
||||
cmd.set_target_zone("deck");
|
||||
cmd.set_target_zone(ZONE_DECK);
|
||||
cmd.set_x(-1); // bottom of deck
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1403,13 +1403,13 @@ void Player::actMoveTopCardToBottom()
|
|||
|
||||
void Player::actMoveTopCardToPlay()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetTopCard(cmd);
|
||||
cmd.set_target_zone("stack");
|
||||
cmd.set_target_zone(ZONE_STACK);
|
||||
cmd.set_x(-1);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1418,17 +1418,17 @@ void Player::actMoveTopCardToPlay()
|
|||
|
||||
void Player::actMoveTopCardToPlayFaceDown()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
CardToMove *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||
cardToMove->set_card_id(0);
|
||||
cardToMove->set_face_down(true);
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("table");
|
||||
cmd.set_target_zone(ZONE_TABLE);
|
||||
cmd.set_x(-1);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1437,13 +1437,13 @@ void Player::actMoveTopCardToPlayFaceDown()
|
|||
|
||||
void Player::actMoveBottomCardToGrave()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetBottomCard(cmd);
|
||||
cmd.set_target_zone("grave");
|
||||
cmd.set_target_zone(ZONE_GRAVEYARD);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1452,13 +1452,13 @@ void Player::actMoveBottomCardToGrave()
|
|||
|
||||
void Player::actMoveBottomCardToExile()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetBottomCard(cmd);
|
||||
cmd.set_target_zone("rfg");
|
||||
cmd.set_target_zone(ZONE_EXILE);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1467,7 +1467,7 @@ void Player::actMoveBottomCardToExile()
|
|||
|
||||
void Player::actMoveBottomCardsToGrave()
|
||||
{
|
||||
const int maxCards = zones.value("deck")->getCards().size();
|
||||
const int maxCards = zones.value(ZONE_DECK)->getCards().size();
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1484,9 +1484,9 @@ void Player::actMoveBottomCardsToGrave()
|
|||
defaultNumberBottomCards = number;
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("grave");
|
||||
cmd.set_target_zone(ZONE_GRAVEYARD);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1499,7 +1499,7 @@ void Player::actMoveBottomCardsToGrave()
|
|||
|
||||
void Player::actMoveBottomCardsToExile()
|
||||
{
|
||||
const int maxCards = zones.value("deck")->getCards().size();
|
||||
const int maxCards = zones.value(ZONE_DECK)->getCards().size();
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1516,9 +1516,9 @@ void Player::actMoveBottomCardsToExile()
|
|||
defaultNumberBottomCards = number;
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("rfg");
|
||||
cmd.set_target_zone(ZONE_EXILE);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1531,13 +1531,13 @@ void Player::actMoveBottomCardsToExile()
|
|||
|
||||
void Player::actMoveBottomCardToTop()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetBottomCard(cmd);
|
||||
cmd.set_target_zone("deck");
|
||||
cmd.set_target_zone(ZONE_DECK);
|
||||
cmd.set_x(0); // top of deck
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1562,13 +1562,13 @@ void Player::actSelectAll()
|
|||
|
||||
void Player::actDrawBottomCard()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetBottomCard(cmd);
|
||||
cmd.set_target_zone("hand");
|
||||
cmd.set_target_zone(ZONE_HAND);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1577,7 +1577,7 @@ void Player::actDrawBottomCard()
|
|||
|
||||
void Player::actDrawBottomCards()
|
||||
{
|
||||
const int maxCards = zones.value("deck")->getCards().size();
|
||||
const int maxCards = zones.value(ZONE_DECK)->getCards().size();
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1593,9 +1593,9 @@ void Player::actDrawBottomCards()
|
|||
defaultNumberBottomCards = number;
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("hand");
|
||||
cmd.set_target_zone(ZONE_HAND);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1608,13 +1608,13 @@ void Player::actDrawBottomCards()
|
|||
|
||||
void Player::actMoveBottomCardToPlay()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmdSetBottomCard(cmd);
|
||||
cmd.set_target_zone("stack");
|
||||
cmd.set_target_zone(ZONE_STACK);
|
||||
cmd.set_x(-1);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1623,21 +1623,21 @@ void Player::actMoveBottomCardToPlay()
|
|||
|
||||
void Player::actMoveBottomCardToPlayFaceDown()
|
||||
{
|
||||
if (zones.value("deck")->getCards().empty()) {
|
||||
if (zones.value(ZONE_DECK)->getCards().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CardZone *zone = zones.value("deck");
|
||||
CardZone *zone = zones.value(ZONE_DECK);
|
||||
int lastCard = zone->getCards().size() - 1;
|
||||
|
||||
Command_MoveCard cmd;
|
||||
cmd.set_start_zone("deck");
|
||||
cmd.set_start_zone(ZONE_DECK);
|
||||
auto *cardToMove = cmd.mutable_cards_to_move()->add_card();
|
||||
cardToMove->set_card_id(lastCard);
|
||||
cardToMove->set_face_down(true);
|
||||
|
||||
cmd.set_target_player_id(getId());
|
||||
cmd.set_target_zone("table");
|
||||
cmd.set_target_zone(ZONE_TABLE);
|
||||
cmd.set_x(-1);
|
||||
cmd.set_y(0);
|
||||
|
||||
|
|
@ -1647,7 +1647,7 @@ void Player::actMoveBottomCardToPlayFaceDown()
|
|||
void Player::actUntapAll()
|
||||
{
|
||||
Command_SetCardAttr cmd;
|
||||
cmd.set_zone("table");
|
||||
cmd.set_zone(ZONE_TABLE);
|
||||
cmd.set_attribute(AttrTapped);
|
||||
cmd.set_attr_value("0");
|
||||
|
||||
|
|
@ -1699,7 +1699,7 @@ void Player::actCreateAnotherToken()
|
|||
}
|
||||
|
||||
Command_CreateToken cmd;
|
||||
cmd.set_zone("table");
|
||||
cmd.set_zone(ZONE_TABLE);
|
||||
cmd.set_card_name(lastTokenName.toStdString());
|
||||
cmd.set_color(lastTokenColor.toStdString());
|
||||
cmd.set_pt(lastTokenPT.toStdString());
|
||||
|
|
@ -1871,7 +1871,7 @@ void Player::createCard(const CardItem *sourceCard,
|
|||
|
||||
// create the token for the related card
|
||||
Command_CreateToken cmd;
|
||||
cmd.set_zone("table");
|
||||
cmd.set_zone(ZONE_TABLE);
|
||||
cmd.set_card_name(cardInfo->getName().toStdString());
|
||||
switch (cardInfo->getColors().size()) {
|
||||
case 0:
|
||||
|
|
@ -2267,7 +2267,7 @@ void Player::eventMoveCard(const Event_MoveCard &event, const GameEventContext &
|
|||
}
|
||||
updateCardMenu(card);
|
||||
|
||||
if (movingCardsUntil && startZoneString == "deck" && targetZone->getName() == "stack") {
|
||||
if (movingCardsUntil && startZoneString == ZONE_DECK && targetZone->getName() == ZONE_STACK) {
|
||||
moveOneCardUntil(card->getInfo());
|
||||
}
|
||||
}
|
||||
|
|
@ -2358,8 +2358,8 @@ void Player::eventAttachCard(const Event_AttachCard &event)
|
|||
|
||||
void Player::eventDrawCards(const Event_DrawCards &event)
|
||||
{
|
||||
CardZone *_deck = zones.value("deck");
|
||||
CardZone *_hand = zones.value("hand");
|
||||
CardZone *_deck = zones.value(ZONE_DECK);
|
||||
CardZone *_hand = zones.value(ZONE_HAND);
|
||||
|
||||
const int listSize = event.cards_size();
|
||||
if (listSize) {
|
||||
|
|
@ -2641,13 +2641,13 @@ void Player::playCard(CardItem *card, bool faceDown, bool tapped)
|
|||
int tableRow = info->getTableRow();
|
||||
bool playToStack = SettingsCache::instance().getPlayToStack();
|
||||
QString currentZone = card->getZone()->getName();
|
||||
if (currentZone == "stack" && tableRow == 3) {
|
||||
cmd.set_target_zone("grave");
|
||||
if (currentZone == ZONE_STACK && tableRow == 3) {
|
||||
cmd.set_target_zone(ZONE_GRAVEYARD);
|
||||
cmd.set_x(0);
|
||||
cmd.set_y(0);
|
||||
} else if (!faceDown &&
|
||||
((!playToStack && tableRow == 3) || ((playToStack && tableRow != 0) && currentZone != "stack"))) {
|
||||
cmd.set_target_zone("stack");
|
||||
((!playToStack && tableRow == 3) || ((playToStack && tableRow != 0) && currentZone != ZONE_STACK))) {
|
||||
cmd.set_target_zone(ZONE_STACK);
|
||||
cmd.set_x(-1);
|
||||
cmd.set_y(0);
|
||||
} else {
|
||||
|
|
@ -2659,7 +2659,7 @@ void Player::playCard(CardItem *card, bool faceDown, bool tapped)
|
|||
}
|
||||
cardToMove->set_tapped(faceDown ? false : tapped);
|
||||
if (tableRow != 3)
|
||||
cmd.set_target_zone("table");
|
||||
cmd.set_target_zone(ZONE_TABLE);
|
||||
cmd.set_x(gridPoint.x());
|
||||
cmd.set_y(gridPoint.y());
|
||||
}
|
||||
|
|
@ -2893,7 +2893,7 @@ bool Player::clearCardsToDelete()
|
|||
|
||||
void Player::actMoveCardXCardsFromTop()
|
||||
{
|
||||
int deckSize = zones.value("deck")->getCards().size() + 1; // add the card to move to the deck
|
||||
int deckSize = zones.value(ZONE_DECK)->getCards().size() + 1; // add the card to move to the deck
|
||||
bool ok;
|
||||
int number =
|
||||
QInputDialog::getInt(game, tr("Place card X cards from top of library"),
|
||||
|
|
@ -2931,7 +2931,7 @@ void Player::actMoveCardXCardsFromTop()
|
|||
cmd->set_start_zone(startZone.toStdString());
|
||||
cmd->mutable_cards_to_move()->CopyFrom(idList);
|
||||
cmd->set_target_player_id(getId());
|
||||
cmd->set_target_zone("deck");
|
||||
cmd->set_target_zone(ZONE_DECK);
|
||||
cmd->set_x(number);
|
||||
cmd->set_y(0);
|
||||
commandList.append(cmd);
|
||||
|
|
@ -3001,7 +3001,7 @@ void Player::cardMenuAction()
|
|||
}
|
||||
case cmClone: {
|
||||
auto *cmd = new Command_CreateToken;
|
||||
cmd->set_zone("table");
|
||||
cmd->set_zone(ZONE_TABLE);
|
||||
cmd->set_card_name(card->getName().toStdString());
|
||||
cmd->set_color(card->getColor().toStdString());
|
||||
cmd->set_pt(card->getPT().toStdString());
|
||||
|
|
@ -3031,13 +3031,13 @@ void Player::cardMenuAction()
|
|||
cmd->set_start_zone(startZone.toStdString());
|
||||
cmd->mutable_cards_to_move()->CopyFrom(idList);
|
||||
cmd->set_target_player_id(getId());
|
||||
cmd->set_target_zone("deck");
|
||||
cmd->set_target_zone(ZONE_DECK);
|
||||
cmd->set_x(0);
|
||||
cmd->set_y(0);
|
||||
|
||||
if (idList.card_size() > 1) {
|
||||
auto *scmd = new Command_Shuffle;
|
||||
scmd->set_zone_name("deck");
|
||||
scmd->set_zone_name(ZONE_DECK);
|
||||
scmd->set_start(0);
|
||||
scmd->set_end(idList.card_size());
|
||||
// Server process events backwards, so...
|
||||
|
|
@ -3053,13 +3053,13 @@ void Player::cardMenuAction()
|
|||
cmd->set_start_zone(startZone.toStdString());
|
||||
cmd->mutable_cards_to_move()->CopyFrom(idList);
|
||||
cmd->set_target_player_id(getId());
|
||||
cmd->set_target_zone("deck");
|
||||
cmd->set_target_zone(ZONE_DECK);
|
||||
cmd->set_x(-1);
|
||||
cmd->set_y(0);
|
||||
|
||||
if (idList.card_size() > 1) {
|
||||
auto *scmd = new Command_Shuffle;
|
||||
scmd->set_zone_name("deck");
|
||||
scmd->set_zone_name(ZONE_DECK);
|
||||
scmd->set_start(-idList.card_size());
|
||||
scmd->set_end(-1);
|
||||
// Server process events backwards, so...
|
||||
|
|
@ -3075,7 +3075,7 @@ void Player::cardMenuAction()
|
|||
cmd->set_start_zone(startZone.toStdString());
|
||||
cmd->mutable_cards_to_move()->CopyFrom(idList);
|
||||
cmd->set_target_player_id(getId());
|
||||
cmd->set_target_zone("hand");
|
||||
cmd->set_target_zone(ZONE_HAND);
|
||||
cmd->set_x(0);
|
||||
cmd->set_y(0);
|
||||
commandList.append(cmd);
|
||||
|
|
@ -3087,7 +3087,7 @@ void Player::cardMenuAction()
|
|||
cmd->set_start_zone(startZone.toStdString());
|
||||
cmd->mutable_cards_to_move()->CopyFrom(idList);
|
||||
cmd->set_target_player_id(getId());
|
||||
cmd->set_target_zone("grave");
|
||||
cmd->set_target_zone(ZONE_GRAVEYARD);
|
||||
cmd->set_x(0);
|
||||
cmd->set_y(0);
|
||||
commandList.append(cmd);
|
||||
|
|
@ -3099,7 +3099,7 @@ void Player::cardMenuAction()
|
|||
cmd->set_start_zone(startZone.toStdString());
|
||||
cmd->mutable_cards_to_move()->CopyFrom(idList);
|
||||
cmd->set_target_player_id(getId());
|
||||
cmd->set_target_zone("rfg");
|
||||
cmd->set_target_zone(ZONE_EXILE);
|
||||
cmd->set_x(0);
|
||||
cmd->set_y(0);
|
||||
commandList.append(cmd);
|
||||
|
|
@ -3580,7 +3580,7 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
}
|
||||
|
||||
if (card->getZone()) {
|
||||
if (card->getZone()->getName() == "table") {
|
||||
if (card->getZone()->getName() == ZONE_TABLE) {
|
||||
// Card is on the battlefield
|
||||
|
||||
if (ptMenu->isEmpty()) {
|
||||
|
|
@ -3633,7 +3633,7 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
cardMenu->addAction(aSetCounter[i]);
|
||||
}
|
||||
cardMenu->addSeparator();
|
||||
} else if (card->getZone()->getName() == "stack") {
|
||||
} else if (card->getZone()->getName() == ZONE_STACK) {
|
||||
// Card is on the stack
|
||||
cardMenu->addAction(aDrawArrow);
|
||||
cardMenu->addSeparator();
|
||||
|
|
@ -3644,7 +3644,7 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
|
||||
addRelatedCardView(card, cardMenu);
|
||||
addRelatedCardActions(card, cardMenu);
|
||||
} else if (card->getZone()->getName() == "rfg" || card->getZone()->getName() == "grave") {
|
||||
} else if (card->getZone()->getName() == ZONE_EXILE || card->getZone()->getName() == ZONE_GRAVEYARD) {
|
||||
// Card is in the graveyard or exile
|
||||
cardMenu->addAction(aSelectAll);
|
||||
cardMenu->addAction(aPlay);
|
||||
|
|
@ -3675,7 +3675,7 @@ void Player::updateCardMenu(const CardItem *card)
|
|||
cardMenu->addMenu(moveMenu);
|
||||
}
|
||||
} else {
|
||||
if (card->getZone() && card->getZone()->getName() != "hand") {
|
||||
if (card->getZone() && card->getZone()->getName() != ZONE_HAND) {
|
||||
cardMenu->addAction(aDrawArrow);
|
||||
cardMenu->addSeparator();
|
||||
addRelatedCardView(card, cardMenu);
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ void CardZone::clearContents()
|
|||
QString CardZone::getTranslatedName(bool theirOwn, GrammaticalCase gc) const
|
||||
{
|
||||
QString ownerName = player->getName();
|
||||
if (name == "hand")
|
||||
if (name == ZONE_HAND)
|
||||
return (theirOwn ? tr("their hand", "nominative") : tr("%1's hand", "nominative").arg(ownerName));
|
||||
else if (name == "deck")
|
||||
else if (name == ZONE_DECK)
|
||||
switch (gc) {
|
||||
case CaseLookAtZone:
|
||||
return (theirOwn ? tr("their library", "look at zone")
|
||||
|
|
@ -86,11 +86,11 @@ QString CardZone::getTranslatedName(bool theirOwn, GrammaticalCase gc) const
|
|||
default:
|
||||
return (theirOwn ? tr("their library", "nominative") : tr("%1's library", "nominative").arg(ownerName));
|
||||
}
|
||||
else if (name == "grave")
|
||||
else if (name == ZONE_GRAVEYARD)
|
||||
return (theirOwn ? tr("their graveyard", "nominative") : tr("%1's graveyard", "nominative").arg(ownerName));
|
||||
else if (name == "rfg")
|
||||
else if (name == ZONE_EXILE)
|
||||
return (theirOwn ? tr("their exile", "nominative") : tr("%1's exile", "nominative").arg(ownerName));
|
||||
else if (name == "sb")
|
||||
else if (name == ZONE_SIDEBOARD)
|
||||
switch (gc) {
|
||||
case CaseLookAtZone:
|
||||
return (theirOwn ? tr("their sideboard", "look at zone")
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <QPainter>
|
||||
|
||||
HandZone::HandZone(Player *_p, bool _contentsKnown, int _zoneHeight, QGraphicsItem *parent)
|
||||
: SelectZone(_p, "hand", false, false, _contentsKnown, parent), zoneHeight(_zoneHeight)
|
||||
: SelectZone(_p, ZONE_HAND, false, false, _contentsKnown, parent), zoneHeight(_zoneHeight)
|
||||
{
|
||||
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
|
||||
updateBg();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <QSet>
|
||||
|
||||
StackZone::StackZone(Player *_p, int _zoneHeight, QGraphicsItem *parent)
|
||||
: SelectZone(_p, "stack", false, false, true, parent), zoneHeight(_zoneHeight)
|
||||
: SelectZone(_p, ZONE_STACK, false, false, true, parent), zoneHeight(_zoneHeight)
|
||||
{
|
||||
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
|
||||
updateBg();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const QColor TableZone::GRADIENT_COLOR = QColor(255, 255, 255, 150);
|
|||
const QColor TableZone::GRADIENT_COLORLESS = QColor(255, 255, 255, 0);
|
||||
|
||||
TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
||||
: SelectZone(_p, "table", true, false, true, parent), active(false)
|
||||
: SelectZone(_p, ZONE_TABLE, true, false, true, parent), active(false)
|
||||
{
|
||||
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
|
||||
connect(&SettingsCache::instance(), SIGNAL(invertVerticalCoordinateChanged()), this, SLOT(reorganizeCards()));
|
||||
|
|
@ -218,7 +218,7 @@ void TableZone::toggleTapped()
|
|||
|
||||
auto isCardOnTable = [](const QGraphicsItem *item) {
|
||||
if (auto card = qgraphicsitem_cast<const CardItem *>(item)) {
|
||||
return card->getZone()->getName() == "table";
|
||||
return card->getZone()->getName() == ZONE_TABLE;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,43 +14,43 @@
|
|||
|
||||
const QString &MessageLogWidget::tableConstant() const
|
||||
{
|
||||
static const QString constant("table");
|
||||
static const QString constant(ZONE_TABLE);
|
||||
return constant;
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::graveyardConstant() const
|
||||
{
|
||||
static const QString constant("grave");
|
||||
static const QString constant(ZONE_GRAVEYARD);
|
||||
return constant;
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::exileConstant() const
|
||||
{
|
||||
static const QString constant("rfg");
|
||||
static const QString constant(ZONE_EXILE);
|
||||
return constant;
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::handConstant() const
|
||||
{
|
||||
static const QString constant("hand");
|
||||
static const QString constant(ZONE_HAND);
|
||||
return constant;
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::deckConstant() const
|
||||
{
|
||||
static const QString constant("deck");
|
||||
static const QString constant(ZONE_DECK);
|
||||
return constant;
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::sideboardConstant() const
|
||||
{
|
||||
static const QString constant("sb");
|
||||
static const QString constant(ZONE_SIDEBOARD);
|
||||
return constant;
|
||||
}
|
||||
|
||||
const QString &MessageLogWidget::stackConstant() const
|
||||
{
|
||||
static const QString constant("stack");
|
||||
static const QString constant(ZONE_STACK);
|
||||
return constant;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <QKeySequence>
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include "../common/card_zones.h"
|
||||
|
||||
class ShortcutGroup
|
||||
{
|
||||
|
|
@ -466,7 +467,7 @@ private:
|
|||
parseSequenceString("Ctrl+Del"),
|
||||
ShortcutGroup::Move_selected)},
|
||||
{"Player/aMoveToHand",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::Move_selected)},
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", ZONE_HAND), parseSequenceString(""), ShortcutGroup::Move_selected)},
|
||||
{"Player/aMoveToTopLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
||||
parseSequenceString(""),
|
||||
ShortcutGroup::Move_selected)},
|
||||
|
|
@ -477,7 +478,7 @@ private:
|
|||
parseSequenceString(""),
|
||||
ShortcutGroup::Move_selected)},
|
||||
{"Player/aViewHand",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::View)},
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", ZONE_HAND), parseSequenceString(""), ShortcutGroup::View)},
|
||||
{"Player/aViewGraveyard",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"), parseSequenceString("F4"), ShortcutGroup::View)},
|
||||
{"Player/aViewLibrary",
|
||||
|
|
@ -493,7 +494,7 @@ private:
|
|||
{"Player/aCloseMostRecentZoneView", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Close Recent View"),
|
||||
parseSequenceString("Esc"),
|
||||
ShortcutGroup::View)},
|
||||
{"Player/aMoveTopToPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"),
|
||||
{"Player/aMoveTopToPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", ZONE_STACK),
|
||||
parseSequenceString("Ctrl+Y"),
|
||||
ShortcutGroup::Move_top)},
|
||||
{"Player/aMoveTopToPlayFaceDown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
|
||||
|
|
@ -517,7 +518,7 @@ private:
|
|||
parseSequenceString(""),
|
||||
ShortcutGroup::Move_top)},
|
||||
{"Player/aMoveBottomToPlay",
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
|
||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", ZONE_STACK), parseSequenceString(""), ShortcutGroup::Move_bottom)},
|
||||
{"Player/aMoveBottomToPlayFaceDown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
|
||||
parseSequenceString(""),
|
||||
ShortcutGroup::Move_bottom)},
|
||||
|
|
|
|||
12
common/card_zones.h
Normal file
12
common/card_zones.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef COCKATRICE_CARD_ZONES_H
|
||||
#define COCKATRICE_CARD_ZONES_H
|
||||
|
||||
#define ZONE_DECK "deck"
|
||||
#define ZONE_SIDEBOARD "sb"
|
||||
#define ZONE_TABLE "table"
|
||||
#define ZONE_HAND "hand"
|
||||
#define ZONE_STACK "stack"
|
||||
#define ZONE_GRAVEYARD "grave"
|
||||
#define ZONE_EXILE "rfg"
|
||||
|
||||
#endif // COCKATRICE_CARD_ZONES_H
|
||||
|
|
@ -80,6 +80,7 @@
|
|||
#include "server_game.h"
|
||||
#include "server_room.h"
|
||||
#include "trice_limits.h"
|
||||
#include "../common/card_zones.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <algorithm>
|
||||
|
|
@ -168,15 +169,15 @@ void Server_Player::setupZones()
|
|||
// ------------------------------------------------------------------
|
||||
|
||||
// Create zones
|
||||
auto *deckZone = new Server_CardZone(this, "deck", false, ServerInfo_Zone::HiddenZone);
|
||||
auto *deckZone = new Server_CardZone(this, ZONE_DECK, false, ServerInfo_Zone::HiddenZone);
|
||||
addZone(deckZone);
|
||||
auto *sbZone = new Server_CardZone(this, "sb", false, ServerInfo_Zone::HiddenZone);
|
||||
auto *sbZone = new Server_CardZone(this, ZONE_SIDEBOARD, false, ServerInfo_Zone::HiddenZone);
|
||||
addZone(sbZone);
|
||||
addZone(new Server_CardZone(this, "table", true, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, "hand", false, ServerInfo_Zone::PrivateZone));
|
||||
addZone(new Server_CardZone(this, "stack", false, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, "grave", false, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, "rfg", false, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, ZONE_TABLE, true, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, ZONE_HAND, false, ServerInfo_Zone::PrivateZone));
|
||||
addZone(new Server_CardZone(this, ZONE_STACK, false, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, ZONE_GRAVEYARD, false, ServerInfo_Zone::PublicZone));
|
||||
addZone(new Server_CardZone(this, ZONE_EXILE, false, ServerInfo_Zone::PublicZone));
|
||||
|
||||
addCounter(new Server_Counter(0, "life", makeColor(255, 255, 255), 25, 20));
|
||||
addCounter(new Server_Counter(1, "w", makeColor(255, 255, 150), 20, 0));
|
||||
|
|
@ -322,8 +323,8 @@ void Server_Player::addCounter(Server_Counter *counter)
|
|||
|
||||
Response::ResponseCode Server_Player::drawCards(GameEventStorage &ges, int number)
|
||||
{
|
||||
Server_CardZone *deckZone = zones.value("deck");
|
||||
Server_CardZone *handZone = zones.value("hand");
|
||||
Server_CardZone *deckZone = zones.value(ZONE_DECK);
|
||||
Server_CardZone *handZone = zones.value(ZONE_HAND);
|
||||
if (deckZone->getCards().size() < number) {
|
||||
number = deckZone->getCards().size();
|
||||
}
|
||||
|
|
@ -480,7 +481,7 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges,
|
|||
// "Undo draw" should only remain valid if the just-drawn card stays within the user's hand (e.g., they only
|
||||
// reorder their hand). If a just-drawn card leaves the hand then remove cards before it from the list
|
||||
// (Ignore the case where the card is currently being un-drawn.)
|
||||
if (startzone->getName() == "hand" && targetzone->getName() != "hand" && !undoingDraw) {
|
||||
if (startzone->getName() == ZONE_HAND && targetzone->getName() != ZONE_HAND && !undoingDraw) {
|
||||
int index = lastDrawList.lastIndexOf(card->getId());
|
||||
if (index != -1) {
|
||||
lastDrawList.erase(lastDrawList.begin(), lastDrawList.begin() + index);
|
||||
|
|
@ -1002,11 +1003,11 @@ Server_Player::cmdShuffle(const Command_Shuffle &cmd, ResponseContainer & /*rc*/
|
|||
return Response::RespContextError;
|
||||
}
|
||||
|
||||
if (cmd.has_zone_name() && cmd.zone_name() != "deck") {
|
||||
if (cmd.has_zone_name() && cmd.zone_name() != ZONE_DECK) {
|
||||
return Response::RespFunctionNotAllowed;
|
||||
}
|
||||
|
||||
Server_CardZone *zone = zones.value("deck");
|
||||
Server_CardZone *zone = zones.value(ZONE_DECK);
|
||||
if (!zone) {
|
||||
return Response::RespNameNotFound;
|
||||
}
|
||||
|
|
@ -1037,8 +1038,8 @@ Server_Player::cmdMulligan(const Command_Mulligan &cmd, ResponseContainer & /*rc
|
|||
return Response::RespContextError;
|
||||
}
|
||||
|
||||
Server_CardZone *hand = zones.value("hand");
|
||||
Server_CardZone *_deck = zones.value("deck");
|
||||
Server_CardZone *hand = zones.value(ZONE_HAND);
|
||||
Server_CardZone *_deck = zones.value(ZONE_DECK);
|
||||
int number = cmd.number();
|
||||
|
||||
if (!hand->getCards().isEmpty()) {
|
||||
|
|
@ -1131,7 +1132,7 @@ Server_Player::cmdUndoDraw(const Command_UndoDraw & /*cmd*/, ResponseContainer &
|
|||
Response::ResponseCode retVal;
|
||||
auto *cardToMove = new CardToMove;
|
||||
cardToMove->set_card_id(lastDrawList.takeLast());
|
||||
retVal = moveCard(ges, zones.value("hand"), QList<const CardToMove *>() << cardToMove, zones.value("deck"), 0, 0,
|
||||
retVal = moveCard(ges, zones.value(ZONE_HAND), QList<const CardToMove *>() << cardToMove, zones.value(ZONE_DECK), 0, 0,
|
||||
false, true);
|
||||
delete cardToMove;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue