diff --git a/cockatrice/src/abstractcarditem.cpp b/cockatrice/src/abstractcarditem.cpp index 83f079f4..204b1d86 100644 --- a/cockatrice/src/abstractcarditem.cpp +++ b/cockatrice/src/abstractcarditem.cpp @@ -37,6 +37,7 @@ QRectF AbstractCardItem::boundingRect() const void AbstractCardItem::pixmapUpdated() { update(); + emit sigPixmapUpdated(); } void AbstractCardItem::cardInfoUpdated() diff --git a/cockatrice/src/abstractcarditem.h b/cockatrice/src/abstractcarditem.h index bad20c15..9a11fad1 100644 --- a/cockatrice/src/abstractcarditem.h +++ b/cockatrice/src/abstractcarditem.h @@ -34,6 +34,7 @@ signals: void showCardInfoPopup(QPoint pos, QString cardName); void deleteCardInfoPopup(QString cardName); void updateCardMenu(AbstractCardItem *card); + void sigPixmapUpdated(); public: enum { Type = typeCard }; int type() const { return Type; } diff --git a/cockatrice/src/pilezone.cpp b/cockatrice/src/pilezone.cpp index 48f37751..97d32902 100644 --- a/cockatrice/src/pilezone.cpp +++ b/cockatrice/src/pilezone.cpp @@ -39,11 +39,15 @@ void PileZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*optio void PileZone::addCardImpl(CardItem *card, int x, int /*y*/) { + connect(card, SIGNAL(sigPixmapUpdated()), this, SLOT(callUpdate())); cards.insert(x, card); card->setPos(0, 0); if (!contentsKnown()) { card->setName(QString()); card->setId(-1); + // If we obscure a previously revealed card, its name has to be forgotten + if (cards.size() > x + 1) + cards.at(x + 1)->setName(QString()); } card->setVisible(false); card->resetState(); diff --git a/cockatrice/src/pilezone.h b/cockatrice/src/pilezone.h index 8b8b074e..8675c99b 100644 --- a/cockatrice/src/pilezone.h +++ b/cockatrice/src/pilezone.h @@ -5,6 +5,8 @@ class PileZone : public CardZone { Q_OBJECT +private slots: + void callUpdate() { update(); } public: PileZone(Player *_p, const QString &_name, bool _isShufflable, bool _contentsKnown, QGraphicsItem *parent = 0); QRectF boundingRect() const; diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 51748bf1..4aa2f401 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -1297,12 +1297,19 @@ void Player::eventRevealCards(const Event_RevealCards &event) emit logRevealCards(this, zone, cardList.at(i)->id(), cardName, this, true); } } else { - if (!cardList.isEmpty()) + bool showZoneView = true; + QString cardName; + if (cardList.size() == 1) { + cardName = QString::fromStdString(cardList.first()->name()); + if ((event.card_id() == 0) && dynamic_cast(zone)) { + zone->getCards().first()->setName(cardName); + zone->update(); + showZoneView = false; + } + } + if (showZoneView && !cardList.isEmpty()) static_cast(scene())->addRevealedZoneView(this, zone, cardList, event.grant_write_access()); - QString cardName; - if (cardList.size() == 1) - cardName = QString::fromStdString(cardList.first()->name()); emit logRevealCards(this, zone, event.card_id(), cardName, otherPlayer, false); } } diff --git a/common/server_player.cpp b/common/server_player.cpp index 5194fa28..d00a25bf 100644 --- a/common/server_player.cpp +++ b/common/server_player.cpp @@ -1582,7 +1582,7 @@ Response::ResponseCode Server_Player::cmdChangeZoneProperties(const Command_Chan ges.enqueueGameEvent(event, playerId); - if (!zone->cards.isEmpty()) { + if (!zone->cards.isEmpty() && cmd.always_reveal_top_card()) { Event_RevealCards revealEvent; revealEvent.set_zone_name(zone->getName().toStdString()); revealEvent.set_card_id(0);