diff --git a/cockatrice/src/client/tabs/tab_deck_editor.cpp b/cockatrice/src/client/tabs/tab_deck_editor.cpp index 1e2284186..d443de82d 100644 --- a/cockatrice/src/client/tabs/tab_deck_editor.cpp +++ b/cockatrice/src/client/tabs/tab_deck_editor.cpp @@ -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")); diff --git a/cockatrice/src/client/ui/phases_toolbar.cpp b/cockatrice/src/client/ui/phases_toolbar.cpp index 036a7c19e..a0ae60ae6 100644 --- a/cockatrice/src/client/ui/phases_toolbar.cpp +++ b/cockatrice/src/client/ui/phases_toolbar.cpp @@ -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"); diff --git a/cockatrice/src/deck/deck_stats_interface.cpp b/cockatrice/src/deck/deck_stats_interface.cpp index 038565370..96de92036 100644 --- a/cockatrice/src/deck/deck_stats_interface.cpp +++ b/cockatrice/src/deck/deck_stats_interface.cpp @@ -9,6 +9,7 @@ #include #include #include +#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()); diff --git a/cockatrice/src/game/board/arrow_item.cpp b/cockatrice/src/game/board/arrow_item.cpp index 430ea6adc..3a665f2c1 100644 --- a/cockatrice/src/game/board/arrow_item.cpp +++ b/cockatrice/src/game/board/arrow_item.cpp @@ -237,15 +237,15 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) PlayerTarget *targetPlayer = qgraphicsitem_cast(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); } diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index f8217305e..a3b8205f8 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -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); diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index 869abecb2..98e8407db 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -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() << "deck" << 0); + aMoveHandToTopLibrary->setData(QList() << ZONE_DECK << 0); aMoveHandToBottomLibrary = new QAction(this); - aMoveHandToBottomLibrary->setData(QList() << "deck" << -1); + aMoveHandToBottomLibrary->setData(QList() << ZONE_DECK << -1); aMoveHandToGrave = new QAction(this); - aMoveHandToGrave->setData(QList() << "grave" << 0); + aMoveHandToGrave->setData(QList() << ZONE_GRAVEYARD << 0); aMoveHandToRfg = new QAction(this); - aMoveHandToRfg->setData(QList() << "rfg" << 0); + aMoveHandToRfg->setData(QList() << 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() << "deck" << 0); + aMoveGraveToTopLibrary->setData(QList() << ZONE_DECK << 0); aMoveGraveToBottomLibrary = new QAction(this); - aMoveGraveToBottomLibrary->setData(QList() << "deck" << -1); + aMoveGraveToBottomLibrary->setData(QList() << ZONE_DECK << -1); aMoveGraveToHand = new QAction(this); - aMoveGraveToHand->setData(QList() << "hand" << 0); + aMoveGraveToHand->setData(QList() << ZONE_HAND << 0); aMoveGraveToRfg = new QAction(this); - aMoveGraveToRfg->setData(QList() << "rfg" << 0); + aMoveGraveToRfg->setData(QList() << 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() << "deck" << 0); + aMoveRfgToTopLibrary->setData(QList() << ZONE_DECK << 0); aMoveRfgToBottomLibrary = new QAction(this); - aMoveRfgToBottomLibrary->setData(QList() << "deck" << -1); + aMoveRfgToBottomLibrary->setData(QList() << ZONE_DECK << -1); aMoveRfgToHand = new QAction(this); - aMoveRfgToHand->setData(QList() << "hand" << 0); + aMoveRfgToHand->setData(QList() << ZONE_HAND << 0); aMoveRfgToGrave = new QAction(this); - aMoveRfgToGrave->setData(QList() << "grave" << 0); + aMoveRfgToGrave->setData(QList() << 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(scene())->toggleZoneView(this, "deck", -1); + static_cast(scene())->toggleZoneView(this, ZONE_DECK, -1); } void Player::actViewHand() { - static_cast(scene())->toggleZoneView(this, "hand", -1); + static_cast(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(scene())->toggleZoneView(this, "deck", number); + static_cast(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(scene())->toggleZoneView(this, "grave", -1); + dynamic_cast(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(scene())->toggleZoneView(this, "rfg", -1); + static_cast(scene())->toggleZoneView(this, ZONE_EXILE, -1); } void Player::actViewSideboard() { - static_cast(scene())->toggleZoneView(this, "sb", -1); + static_cast(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); diff --git a/cockatrice/src/game/zones/card_zone.cpp b/cockatrice/src/game/zones/card_zone.cpp index 4dd6b3409..b02a07543 100644 --- a/cockatrice/src/game/zones/card_zone.cpp +++ b/cockatrice/src/game/zones/card_zone.cpp @@ -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") diff --git a/cockatrice/src/game/zones/hand_zone.cpp b/cockatrice/src/game/zones/hand_zone.cpp index 5b6932902..9857b1b7e 100644 --- a/cockatrice/src/game/zones/hand_zone.cpp +++ b/cockatrice/src/game/zones/hand_zone.cpp @@ -10,7 +10,7 @@ #include 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(); diff --git a/cockatrice/src/game/zones/stack_zone.cpp b/cockatrice/src/game/zones/stack_zone.cpp index 3a6d8d0f2..e40d79877 100644 --- a/cockatrice/src/game/zones/stack_zone.cpp +++ b/cockatrice/src/game/zones/stack_zone.cpp @@ -12,7 +12,7 @@ #include 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(); diff --git a/cockatrice/src/game/zones/table_zone.cpp b/cockatrice/src/game/zones/table_zone.cpp index 0aace73ca..38c01d473 100644 --- a/cockatrice/src/game/zones/table_zone.cpp +++ b/cockatrice/src/game/zones/table_zone.cpp @@ -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(item)) { - return card->getZone()->getName() == "table"; + return card->getZone()->getName() == ZONE_TABLE; } return false; }; diff --git a/cockatrice/src/server/message_log_widget.cpp b/cockatrice/src/server/message_log_widget.cpp index 0538517f5..b02426cfb 100644 --- a/cockatrice/src/server/message_log_widget.cpp +++ b/cockatrice/src/server/message_log_widget.cpp @@ -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; } diff --git a/cockatrice/src/settings/shortcuts_settings.h b/cockatrice/src/settings/shortcuts_settings.h index 16311d6ce..434cd614d 100644 --- a/cockatrice/src/settings/shortcuts_settings.h +++ b/cockatrice/src/settings/shortcuts_settings.h @@ -6,6 +6,7 @@ #include #include #include +#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)}, diff --git a/common/card_zones.h b/common/card_zones.h new file mode 100644 index 000000000..400621553 --- /dev/null +++ b/common/card_zones.h @@ -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 diff --git a/common/server_player.cpp b/common/server_player.cpp index adf1a66e0..65c996399 100644 --- a/common/server_player.cpp +++ b/common/server_player.cpp @@ -80,6 +80,7 @@ #include "server_game.h" #include "server_room.h" #include "trice_limits.h" +#include "../common/card_zones.h" #include #include @@ -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() << cardToMove, zones.value("deck"), 0, 0, + retVal = moveCard(ges, zones.value(ZONE_HAND), QList() << cardToMove, zones.value(ZONE_DECK), 0, 0, false, true); delete cardToMove; diff --git a/webclient/src/i18n-default.json b/webclient/src/i18n-default.json index 3aabe58f6..36abca615 100644 --- a/webclient/src/i18n-default.json +++ b/webclient/src/i18n-default.json @@ -1,382 +1 @@ -{ - "Common": { - "language": "English", - "disconnect": "Disconnect", - "label": { - "confirmPassword": "Confirm Password", - "confirmSure": "Are you sure?", - "country": "Country", - "delete": "Delete", - "email": "Email", - "hostName": "Host Name", - "hostAddress": "Host Address", - "password": "Password", - "passwordAgain": "Password Again", - "port": "Port", - "realName": "Real Name", - "saveChanges": "Save Changes", - "token": "Token", - "username": "Username" - }, - "validation": { - "minChars": "Minimum of {count} {count, plural, one {character} other {characters}} required", - "passwordsMustMatch": "Passwords don't match", - "required": "Required" - }, - "countries": { - "AD": "Andorra", - "AE": "United Arab Emirates", - "AF": "Afghanistan", - "AG": "Antigua and Barbuda", - "AI": "Anguilla", - "AL": "Albania", - "AM": "Armenia", - "AO": "Angola", - "AQ": "Antarctica", - "AR": "Argentina", - "AS": "American Samoa", - "AT": "Austria", - "AU": "Australia", - "AW": "Aruba", - "AX": "Åland Islands", - "AZ": "Azerbaijan", - "BA": "Bosnia and Herzegovina", - "BB": "Barbados", - "BD": "Bangladesh", - "BE": "Belgium", - "BF": "Burkina Faso", - "BG": "Bulgaria", - "BH": "Bahrain", - "BI": "Burundi", - "BJ": "Benin", - "BL": "Saint Barthélemy", - "BM": "Bermuda", - "BN": "Brunei Darussalam", - "BO": "Bolivia", - "BQ": "Bonaire, Sint Eustatius and Saba", - "BR": "Brazil", - "BS": "Bahamas", - "BT": "Bhutan", - "BV": "Bouvet Island", - "BW": "Botswana", - "BY": "Belarus", - "BZ": "Belize", - "CA": "Canada", - "CC": "Cocos (Keeling) Islands", - "CD": "DR Congo", - "CF": "Central African Republic", - "CG": "Republic of the Congo", - "CH": "Switzerland", - "CI": "Ivory Coast", - "CK": "Cook Islands", - "CL": "Chile", - "CM": "Cameroon", - "CN": "China", - "CO": "Colombia", - "CR": "Costa Rica", - "CU": "Cuba", - "CV": "Cape Verde", - "CW": "Curaçao", - "CX": "Christmas Island", - "CY": "Cyprus", - "CZ": "Czechia", - "DE": "Germany", - "DJ": "Djibouti", - "DK": "Denmark", - "DM": "Dominica", - "DO": "Dominican Republic", - "DZ": "Algeria", - "EC": "Ecuador", - "EE": "Estonia", - "EG": "Egypt", - "EH": "Western Sahara", - "ER": "Eritrea", - "ES": "Spain", - "ET": "Ethiopia", - "FI": "Finland", - "FJ": "Fiji", - "FK": "Falkland Islands", - "FM": "Micronesia", - "FO": "Faroe Islands", - "FR": "France", - "GA": "Gabon", - "GB": "United Kingdom", - "GD": "Grenada", - "GE": "Georgia", - "GF": "French Guiana", - "GG": "Guernsey", - "GH": "Ghana", - "GI": "Gibraltar", - "GL": "Greenland", - "GM": "Gambia", - "GN": "Guinea", - "GP": "Guadeloupe", - "GQ": "Equatorial Guinea", - "GR": "Greece", - "GS": "South Georgia and the South Sandwich Islands", - "GT": "Guatemala", - "GU": "Guam", - "GW": "Guinea-Bissau", - "GY": "Guyana", - "HK": "Hong Kong", - "HM": "Heard Island and McDonald Islands", - "HN": "Honduras", - "HR": "Croatia", - "HT": "Haiti", - "HU": "Hungary", - "ID": "Indonesia", - "IE": "Ireland", - "IL": "Israel", - "IM": "Isle of Man", - "IN": "India", - "IO": "British Indian Ocean Territory", - "IQ": "Iraq", - "IR": "Iran", - "IS": "Iceland", - "IT": "Italy", - "JE": "Jersey", - "JM": "Jamaica", - "JO": "Jordan", - "JP": "Japan", - "KE": "Kenya", - "KG": "Kyrgyzstan", - "KH": "Cambodia", - "KI": "Kiribati", - "KM": "Comoros", - "KN": "Saint Kitts and Nevis", - "KP": "North Korea", - "KR": "South Korea", - "KW": "Kuwait", - "KY": "Cayman Islands", - "KZ": "Kazakhstan", - "LA": "Laos", - "LB": "Lebanon", - "LC": "Saint Lucia", - "LI": "Liechtenstein", - "LK": "Sri Lanka", - "LR": "Liberia", - "LS": "Lesotho", - "LT": "Lithuania", - "LU": "Luxembourg", - "LV": "Latvia", - "LY": "Libya", - "MA": "Morocco", - "MC": "Monaco", - "MD": "Moldova", - "ME": "Montenegro", - "MF": "Saint Martin (French part)", - "MG": "Madagascar", - "MH": "Marshall Islands", - "MK": "North Macedonia", - "ML": "Mali", - "MM": "Myanmar", - "MN": "Mongolia", - "MO": "Macao", - "MP": "Northern Mariana Islands", - "MQ": "Martinique", - "MR": "Mauritania", - "MS": "Montserrat", - "MT": "Malta", - "MU": "Mauritius", - "MV": "Maldives", - "MW": "Malawi", - "MX": "Mexico", - "MY": "Malaysia", - "MZ": "Mozambique", - "NA": "Namibia", - "NC": "New Caledonia", - "NE": "Niger", - "NF": "Norfolk Island", - "NG": "Nigeria", - "NI": "Nicaragua", - "NL": "Netherlands", - "NO": "Norway", - "NP": "Nepal", - "NR": "Nauru", - "NU": "Niue", - "NZ": "New Zealand", - "OM": "Oman", - "PA": "Panama", - "PE": "Peru", - "PF": "French Polynesia", - "PG": "Papua New Guinea", - "PH": "Philippines", - "PK": "Pakistan", - "PL": "Poland", - "PM": "Saint Pierre and Miquelon", - "PN": "Pitcairn", - "PR": "Puerto Rico", - "PS": "Palestine", - "PT": "Portugal", - "PW": "Palau", - "PY": "Paraguay", - "QA": "Qatar", - "RE": "Réunion", - "RO": "Romania", - "RS": "Serbia", - "RU": "Russia", - "RW": "Rwanda", - "SA": "Saudi Arabia", - "SB": "Solomon Islands", - "SC": "Seychelles", - "SD": "Sudan", - "SE": "Sweden", - "SG": "Singapore", - "SH": "Saint Helena, Ascension and Tristan da Cunha", - "SI": "Slovenia", - "SJ": "Svalbard and Jan Mayen", - "SK": "Slovakia", - "SL": "Sierra Leone", - "SM": "San Marino", - "SN": "Senegal", - "SO": "Somalia", - "SR": "Suriname", - "SS": "South Sudan", - "ST": "Sao Tome and Principe", - "SV": "El Salvador", - "SX": "Sint Maarten (Dutch part)", - "SY": "Syria", - "SZ": "Eswatini", - "TC": "Turks and Caicos Islands", - "TD": "Chad", - "TF": "TAAF", - "TG": "Togo", - "TH": "Thailand", - "TJ": "Tajikistan", - "TK": "Tokelau", - "TL": "Timor-Leste", - "TM": "Turkmenistan", - "TN": "Tunisia", - "TO": "Tonga", - "TR": "Turkey", - "TT": "Trinidad and Tobago", - "TV": "Tuvalu", - "TW": "Taiwan", - "TZ": "Tanzania", - "UA": "Ukraine", - "UG": "Uganda", - "UM": "United States Minor Outlying Islands", - "US": "United States", - "UY": "Uruguay", - "UZ": "Uzbekistan", - "VA": "Holy See", - "VC": "Saint Vincent and the Grenadines", - "VE": "Venezuela", - "VG": "British Virgin Islands", - "VI": "U.S. Virgin Islands", - "VN": "Viet Nam", - "VU": "Vanuatu", - "WF": "Wallis and Futuna", - "WS": "Samoa", - "YE": "Yemen", - "YT": "Mayotte", - "XK": "Kosovo", - "ZA": "South Africa", - "ZM": "Zambia", - "ZW": "Zimbabwe", - "EU": "European Union" - }, - "languages": { - "en-US": "English - US", - "fr": "French", - "nl": "Dutch", - "pt_BR": "Portuguese - Brazil" - } - }, - "KnownHosts": { - "label": "Host", - "add": "Add new host", - "toast": "Host successfully {mode, select, created {created} deleted {deleted} other {edited}}." - }, - "InitializeContainer": { - "title": "DID YOU KNOW", - "subtitle": "<1>Cockatrice is run by volunteers<1>that love card games!" - }, - "LoginContainer": { - "header": { - "title": "Login", - "subtitle": "A cross-platform virtual tabletop for multiplayer card games." - }, - "footer": { - "registerPrompt": "Not registered yet?", - "registerAction": "Create an account", - "credit": "Cockatrice is an open source project", - "version": "Version" - }, - "content": { - "subtitle1": "Play multiplayer card games online.", - "subtitle2": "Cross-platform virtual tabletop for multiplayer card games. Forever free." - }, - "toasts": { - "passwordResetSuccessToast": "Password Reset Successfully", - "accountActivationSuccess": "Account Activated Successfully" - } - }, - "UnsupportedContainer": { - "title": "Unsupported Browser", - "subtitle1": "Please update your browser and/or check your permissions.", - "subtitle2": "Note: Private browsing causes some browsers to disable certain permissions or features." - }, - "AccountActivationDialog": { - "title": "Account Activation", - "subtitle1": "Your account has not been activated yet.", - "subtitle2": "You need to provide the activation token received in the activation email." - }, - "KnownHostDialog": { - "title": "{mode, select, edit {Edit} other {Add}} Known Host", - "subtitle": "Adding a new host allows you to connect to different servers. Enter the details below to your host list." - }, - "RegistrationDialog": { - "title": "Create New Account" - }, - "RequestPasswordResetDialog": { - "title": "Request Password Reset" - }, - "ResetPasswordDialog": { - "title": "Reset Password" - }, - "AccountActivationForm": { - "error": { - "failed": "Account activation failed" - }, - "label": { - "activate": "Activate Account" - } - }, - "KnownHostForm": { - "help": "Need help adding a new host?", - "label": { - "add": "Add Host", - "find": "Find Host" - } - }, - "LoginForm": { - "label": { - "autoConnect": "Auto Connect", - "forgot": "Forgot Password", - "login": "Login", - "savePassword": "Save Password", - "savedPassword": "Saved Password" - } - }, - "RegisterForm": { - "label": { - "register": "Register" - }, - "toast": { - "registerSuccess": "Registration Successful!" - } - }, - "RequestPasswordResetForm": { - "error": "Request password reset failed", - "mfaEnabled": "Server has multi-factor authentication enabled", - "request": "Request Reset Token", - "skipRequest": "I already have a reset token" - }, - "ResetPasswordForm": { - "error": "Password reset failed", - "label": { - "reset": "Reset Password" - } - } -} +{"Common":{"language":"English","disconnect":"Disconnect","label":{"confirmPassword":"Confirm Password","confirmSure":"Are you sure?","country":"Country","delete":"Delete","email":"Email","hostName":"Host Name","hostAddress":"Host Address","password":"Password","passwordAgain":"Password Again","port":"Port","realName":"Real Name","saveChanges":"Save Changes","token":"Token","username":"Username"},"validation":{"minChars":"Minimum of {count} {count, plural, one {character} other {characters}} required","passwordsMustMatch":"Passwords don't match","required":"Required"},"countries":{"AD":"Andorra","AE":"United Arab Emirates","AF":"Afghanistan","AG":"Antigua and Barbuda","AI":"Anguilla","AL":"Albania","AM":"Armenia","AO":"Angola","AQ":"Antarctica","AR":"Argentina","AS":"American Samoa","AT":"Austria","AU":"Australia","AW":"Aruba","AX":"Åland Islands","AZ":"Azerbaijan","BA":"Bosnia and Herzegovina","BB":"Barbados","BD":"Bangladesh","BE":"Belgium","BF":"Burkina Faso","BG":"Bulgaria","BH":"Bahrain","BI":"Burundi","BJ":"Benin","BL":"Saint Barthélemy","BM":"Bermuda","BN":"Brunei Darussalam","BO":"Bolivia","BQ":"Bonaire, Sint Eustatius and Saba","BR":"Brazil","BS":"Bahamas","BT":"Bhutan","BV":"Bouvet Island","BW":"Botswana","BY":"Belarus","BZ":"Belize","CA":"Canada","CC":"Cocos (Keeling) Islands","CD":"DR Congo","CF":"Central African Republic","CG":"Republic of the Congo","CH":"Switzerland","CI":"Ivory Coast","CK":"Cook Islands","CL":"Chile","CM":"Cameroon","CN":"China","CO":"Colombia","CR":"Costa Rica","CU":"Cuba","CV":"Cape Verde","CW":"Curaçao","CX":"Christmas Island","CY":"Cyprus","CZ":"Czechia","DE":"Germany","DJ":"Djibouti","DK":"Denmark","DM":"Dominica","DO":"Dominican Republic","DZ":"Algeria","EC":"Ecuador","EE":"Estonia","EG":"Egypt","EH":"Western Sahara","ER":"Eritrea","ES":"Spain","ET":"Ethiopia","FI":"Finland","FJ":"Fiji","FK":"Falkland Islands","FM":"Micronesia","FO":"Faroe Islands","FR":"France","GA":"Gabon","GB":"United Kingdom","GD":"Grenada","GE":"Georgia","GF":"French Guiana","GG":"Guernsey","GH":"Ghana","GI":"Gibraltar","GL":"Greenland","GM":"Gambia","GN":"Guinea","GP":"Guadeloupe","GQ":"Equatorial Guinea","GR":"Greece","GS":"South Georgia and the South Sandwich Islands","GT":"Guatemala","GU":"Guam","GW":"Guinea-Bissau","GY":"Guyana","HK":"Hong Kong","HM":"Heard Island and McDonald Islands","HN":"Honduras","HR":"Croatia","HT":"Haiti","HU":"Hungary","ID":"Indonesia","IE":"Ireland","IL":"Israel","IM":"Isle of Man","IN":"India","IO":"British Indian Ocean Territory","IQ":"Iraq","IR":"Iran","IS":"Iceland","IT":"Italy","JE":"Jersey","JM":"Jamaica","JO":"Jordan","JP":"Japan","KE":"Kenya","KG":"Kyrgyzstan","KH":"Cambodia","KI":"Kiribati","KM":"Comoros","KN":"Saint Kitts and Nevis","KP":"North Korea","KR":"South Korea","KW":"Kuwait","KY":"Cayman Islands","KZ":"Kazakhstan","LA":"Laos","LB":"Lebanon","LC":"Saint Lucia","LI":"Liechtenstein","LK":"Sri Lanka","LR":"Liberia","LS":"Lesotho","LT":"Lithuania","LU":"Luxembourg","LV":"Latvia","LY":"Libya","MA":"Morocco","MC":"Monaco","MD":"Moldova","ME":"Montenegro","MF":"Saint Martin (French part)","MG":"Madagascar","MH":"Marshall Islands","MK":"North Macedonia","ML":"Mali","MM":"Myanmar","MN":"Mongolia","MO":"Macao","MP":"Northern Mariana Islands","MQ":"Martinique","MR":"Mauritania","MS":"Montserrat","MT":"Malta","MU":"Mauritius","MV":"Maldives","MW":"Malawi","MX":"Mexico","MY":"Malaysia","MZ":"Mozambique","NA":"Namibia","NC":"New Caledonia","NE":"Niger","NF":"Norfolk Island","NG":"Nigeria","NI":"Nicaragua","NL":"Netherlands","NO":"Norway","NP":"Nepal","NR":"Nauru","NU":"Niue","NZ":"New Zealand","OM":"Oman","PA":"Panama","PE":"Peru","PF":"French Polynesia","PG":"Papua New Guinea","PH":"Philippines","PK":"Pakistan","PL":"Poland","PM":"Saint Pierre and Miquelon","PN":"Pitcairn","PR":"Puerto Rico","PS":"Palestine","PT":"Portugal","PW":"Palau","PY":"Paraguay","QA":"Qatar","RE":"Réunion","RO":"Romania","RS":"Serbia","RU":"Russia","RW":"Rwanda","SA":"Saudi Arabia","SB":"Solomon Islands","SC":"Seychelles","SD":"Sudan","SE":"Sweden","SG":"Singapore","SH":"Saint Helena, Ascension and Tristan da Cunha","SI":"Slovenia","SJ":"Svalbard and Jan Mayen","SK":"Slovakia","SL":"Sierra Leone","SM":"San Marino","SN":"Senegal","SO":"Somalia","SR":"Suriname","SS":"South Sudan","ST":"Sao Tome and Principe","SV":"El Salvador","SX":"Sint Maarten (Dutch part)","SY":"Syria","SZ":"Eswatini","TC":"Turks and Caicos Islands","TD":"Chad","TF":"TAAF","TG":"Togo","TH":"Thailand","TJ":"Tajikistan","TK":"Tokelau","TL":"Timor-Leste","TM":"Turkmenistan","TN":"Tunisia","TO":"Tonga","TR":"Turkey","TT":"Trinidad and Tobago","TV":"Tuvalu","TW":"Taiwan","TZ":"Tanzania","UA":"Ukraine","UG":"Uganda","UM":"United States Minor Outlying Islands","US":"United States","UY":"Uruguay","UZ":"Uzbekistan","VA":"Holy See","VC":"Saint Vincent and the Grenadines","VE":"Venezuela","VG":"British Virgin Islands","VI":"U.S. Virgin Islands","VN":"Viet Nam","VU":"Vanuatu","WF":"Wallis and Futuna","WS":"Samoa","YE":"Yemen","YT":"Mayotte","XK":"Kosovo","ZA":"South Africa","ZM":"Zambia","ZW":"Zimbabwe","EU":"European Union"},"languages":{"en-US":"English - US","fr":"French","nl":"Dutch","pt_BR":"Portuguese - Brazil"}},"KnownHosts":{"label":"Host","add":"Add new host","toast":"Host successfully {mode, select, created {created} deleted {deleted} other {edited}}."},"InitializeContainer":{"title":"DID YOU KNOW","subtitle":"<1>Cockatrice is run by volunteers<1>that love card games!"},"LoginContainer":{"header":{"title":"Login","subtitle":"A cross-platform virtual tabletop for multiplayer card games."},"footer":{"registerPrompt":"Not registered yet?","registerAction":"Create an account","credit":"Cockatrice is an open source project","version":"Version"},"content":{"subtitle1":"Play multiplayer card games online.","subtitle2":"Cross-platform virtual tabletop for multiplayer card games. Forever free."},"toasts":{"passwordResetSuccessToast":"Password Reset Successfully","accountActivationSuccess":"Account Activated Successfully"}},"UnsupportedContainer":{"title":"Unsupported Browser","subtitle1":"Please update your browser and/or check your permissions.","subtitle2":"Note: Private browsing causes some browsers to disable certain permissions or features."},"AccountActivationDialog":{"title":"Account Activation","subtitle1":"Your account has not been activated yet.","subtitle2":"You need to provide the activation token received in the activation email."},"KnownHostDialog":{"title":"{mode, select, edit {Edit} other {Add}} Known Host","subtitle":"Adding a new host allows you to connect to different servers. Enter the details below to your host list."},"RegistrationDialog":{"title":"Create New Account"},"RequestPasswordResetDialog":{"title":"Request Password Reset"},"ResetPasswordDialog":{"title":"Reset Password"},"AccountActivationForm":{"error":{"failed":"Account activation failed"},"label":{"activate":"Activate Account"}},"KnownHostForm":{"help":"Need help adding a new host?","label":{"add":"Add Host","find":"Find Host"}},"LoginForm":{"label":{"autoConnect":"Auto Connect","forgot":"Forgot Password","login":"Login","savePassword":"Save Password","savedPassword":"Saved Password"}},"RegisterForm":{"label":{"register":"Register"},"toast":{"registerSuccess":"Registration Successful!"}},"RequestPasswordResetForm":{"error":"Request password reset failed","mfaEnabled":"Server has multi-factor authentication enabled","request":"Request Reset Token","skipRequest":"I already have a reset token"},"ResetPasswordForm":{"error":"Password reset failed","label":{"reset":"Reset Password"}}} \ No newline at end of file