AlwaysRevealTopCard done, issue #31 fixed
This commit is contained in:
parent
840b577f42
commit
c835a827b0
6 changed files with 20 additions and 5 deletions
|
@ -37,6 +37,7 @@ QRectF AbstractCardItem::boundingRect() const
|
|||
void AbstractCardItem::pixmapUpdated()
|
||||
{
|
||||
update();
|
||||
emit sigPixmapUpdated();
|
||||
}
|
||||
|
||||
void AbstractCardItem::cardInfoUpdated()
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<PileZone *>(zone)) {
|
||||
zone->getCards().first()->setName(cardName);
|
||||
zone->update();
|
||||
showZoneView = false;
|
||||
}
|
||||
}
|
||||
if (showZoneView && !cardList.isEmpty())
|
||||
static_cast<GameScene *>(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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue