Show the library edge on the card in limited deck views (#6741) (#6741)

Limited deck views (view top/bottom N cards, scry, surveil) made it
ambiguous which card was the top or bottom of the library. Label the card
itself with a small in-view marker instead of placing text above or below
the whole zone, which became ambiguous once the grid used several columns
or the window was resized.

The marker stays on the part of its card that the column leaves visible:
for a top view, the right end of the exposed strip of the first card; for
a bottom view, the bottom-left corner of the last, fully visible card.

The view logic now answers whether it is a limited library-end view and
which edge it shows. The graphics zone draws and positions a marker on
the first or last displayed card, and re-translates its tooltip with the
rest of the zone view.

Co-authored-by: Lukas Brübach <44814898+BruebachL@users.noreply.github.com>
This commit is contained in:
scotland0208 2026-11-07 10:24:40 -06:00 • committed by GitHub
parent 80986266b9
commit d9cd308a2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 243 additions and 2 deletions

View file

@ -5,6 +5,7 @@
#include <libcockatrice/game/zones/hand_zone_logic.h>
#include <libcockatrice/game/zones/view_zone_logic.h>
#include <libcockatrice/utility/card_ref.h>
#include <libcockatrice/utility/zone_names.h>
namespace
{
@ -105,3 +106,30 @@ TEST(CardZoneLogicTest, ReorganizeSignalFiresOnAdd)
EXPECT_EQ(reorganizeSpy.count(), 1);
}
TEST(CardZoneLogicTest, LibraryEdgeViewIsLimitedToOneEndOfTheLibrary)
{
HandZoneLogic deck(nullptr, QString::fromLatin1(ZoneNames::DECK), false, true, true);
HandZoneLogic grave(nullptr, QString::fromLatin1(ZoneNames::GRAVE), false, true, true);
ZoneViewZoneLogic fullDeckView(nullptr, &deck, -1, false, false, false);
EXPECT_FALSE(fullDeckView.isLibraryEdgeView());
EXPECT_FALSE(fullDeckView.showsTopOfLibrary());
EXPECT_FALSE(fullDeckView.showsBottomOfLibrary());
ZoneViewZoneLogic emptyDeckView(nullptr, &deck, 0, false, false, false);
EXPECT_FALSE(emptyDeckView.isLibraryEdgeView());
ZoneViewZoneLogic topView(nullptr, &deck, 3, false, false, false);
EXPECT_TRUE(topView.isLibraryEdgeView());
EXPECT_TRUE(topView.showsTopOfLibrary());
EXPECT_FALSE(topView.showsBottomOfLibrary());
ZoneViewZoneLogic bottomView(nullptr, &deck, 3, false, false, true);
EXPECT_TRUE(bottomView.isLibraryEdgeView());
EXPECT_FALSE(bottomView.showsTopOfLibrary());
EXPECT_TRUE(bottomView.showsBottomOfLibrary());
ZoneViewZoneLogic graveView(nullptr, &grave, 3, false, false, false);
EXPECT_FALSE(graveView.isLibraryEdgeView());
}