diff --git a/cockatrice/src/game/player/player.cpp b/cockatrice/src/game/player/player.cpp index e2f40b0f2..c893e27af 100644 --- a/cockatrice/src/game/player/player.cpp +++ b/cockatrice/src/game/player/player.cpp @@ -124,7 +124,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 = addZone(this, "deck", true, false, playerArea); + auto *_deck = addZone(new PileZone(this, "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); @@ -135,23 +135,23 @@ 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 = addZone(this, "grave", false, true, playerArea); + PileZone *grave = addZone(new PileZone(this, "grave", false, true, playerArea)); grave->setPos(base + QPointF(0, h + h2 + 10)); - PileZone *rfg = addZone(this, "rfg", false, true, playerArea); + PileZone *rfg = addZone(new PileZone(this, "rfg", false, true, playerArea)); rfg->setPos(base + QPointF(0, 2 * h + h2 + 10)); - PileZone *sb = addZone(this, "sb", false, false, playerArea); + PileZone *sb = addZone(new PileZone(this, "sb", false, false, playerArea)); sb->setVisible(false); - table = addZone(this, this); + table = addZone(new TableZone(this, this)); connect(table, &TableZone::sizeChanged, this, &Player::updateBoundingRect); - stack = addZone(this, (int)table->boundingRect().height(), this); + stack = addZone(new StackZone(this, (int)table->boundingRect().height(), this)); - hand = - addZone(this, _local || _judge || (_parent->getSpectator() && _parent->getSpectatorsSeeEverything()), - (int)table->boundingRect().height(), this); + hand = addZone(new HandZone(this, + _local || _judge || (_parent->getSpectator() && _parent->getSpectatorsSeeEverything()), + (int)table->boundingRect().height(), this)); connect(hand, &HandZone::cardCountChanged, handCounter, &HandCounter::updateNumber); connect(handCounter, &HandCounter::showContextMenu, hand, &HandZone::showContextMenu); diff --git a/cockatrice/src/game/player/player.h b/cockatrice/src/game/player/player.h index e2d4bfb54..027a7658b 100644 --- a/cockatrice/src/game/player/player.h +++ b/cockatrice/src/game/player/player.h @@ -410,9 +410,8 @@ public: void addCard(CardItem *c); void deleteCard(CardItem *c); - template T *addZone(Args &&...args) + template T *addZone(T *zone) { - T *zone = new T(std::forward(args)...); zones.insert(zone->getName(), zone); return zone; }