From 3e07d06825e4b73dbf89778e5237c3bf88ed8bf9 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Fri, 3 Jan 2025 20:23:35 -0800 Subject: [PATCH] almost works --- cockatrice/src/game/game_scene.cpp | 3 ++- cockatrice/src/game/zones/view_zone.cpp | 18 +++++------------- cockatrice/src/game/zones/view_zone_widget.cpp | 3 ++- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index b657b596c..71937f1dc 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -151,7 +151,8 @@ void GameScene::toggleZoneView(Player *player, const QString &zoneName, int numb } } - ZoneViewWidget *item = new ZoneViewWidget(player, player->getZones().value(zoneName), numberCards, false, false, {}, isReversed); + ZoneViewWidget *item = + new ZoneViewWidget(player, player->getZones().value(zoneName), numberCards, false, false, {}, isReversed); zoneViews.append(item); connect(item, SIGNAL(closePressed(ZoneViewWidget *)), this, SLOT(removeZoneView(ZoneViewWidget *))); addItem(item); diff --git a/cockatrice/src/game/zones/view_zone.cpp b/cockatrice/src/game/zones/view_zone.cpp index 812a3fbc7..9c7f27887 100644 --- a/cockatrice/src/game/zones/view_zone.cpp +++ b/cockatrice/src/game/zones/view_zone.cpp @@ -121,34 +121,26 @@ void ZoneViewZone::updateCardIds(CardAction action, int index) return; } - auto startId = isReversed ? cards.first()->getId() : 0; + auto startId = 0; if (isReversed) { - if (cards.first()->getId() != firstCardId) { - startId -= 1; - } + startId = origZone->getCards().size() - cards.size(); qDebug() << "TRACK" << "action" << action << "index" << index << "startId" << startId; + // these get called after this zone's card list updates but before parent zone's card list updates switch (action) { case INITIALIZE: break; case ADD_CARD: - if (index > startId) { + if (index < cards.first()->getId()) { startId += 1; } + startId += 1; break; case REMOVE_CARD: startId -= 1; break; } - /*if (cards.first()->getId() != firstCardId) { - startId -= 1; - } - if (origZone->getCards().size() != previousOrigSize) { - qDebug() << "TRACK origZoneSize changed" << "orig" << origZone->getCards().size() << "prev" - << previousOrigSize; - previousOrigSize = origZone->getCards().size(); - }*/ } for (int i = 0; i < cardCount; ++i) { diff --git a/cockatrice/src/game/zones/view_zone_widget.cpp b/cockatrice/src/game/zones/view_zone_widget.cpp index 605f004f4..f1e96c532 100644 --- a/cockatrice/src/game/zones/view_zone_widget.cpp +++ b/cockatrice/src/game/zones/view_zone_widget.cpp @@ -108,7 +108,8 @@ ZoneViewWidget::ZoneViewWidget(Player *_player, vbox->addItem(zoneHBox); - zone = new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer, _isReversed); + zone = + new ZoneViewZone(player, _origZone, numberCards, _revealZone, _writeableRevealZone, zoneContainer, _isReversed); connect(zone, SIGNAL(wheelEventReceived(QGraphicsSceneWheelEvent *)), scrollBarProxy, SLOT(recieveWheelEvent(QGraphicsSceneWheelEvent *)));