Cockatrice 2026-04-21-Development-2.11.0-beta.61
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardZoneAlgorithms Namespace Reference

Functions

template<typename CardList, typename CardType>
void addCardToList (CardList &cards, CardType *card, int x, bool keepAnnotations)

Function Documentation

◆ addCardToList()

template<typename CardList, typename CardType>
void CardZoneAlgorithms::addCardToList ( CardList & cards,
CardType * card,
int x,
bool keepAnnotations )

Shared insertion logic for zones where cards become visible on add and follow the standard pattern: clamp index, insert, clear identity if contents unknown, reset state, show card.

Zones with different post-add behavior (signal connections, positional resets, hidden cards, or coordinate-based placement) should NOT use this — implement addCardImpl directly instead.

Template parameters allow testing with lightweight mocks that avoid Qt graphics dependencies.

Template Parameters
CardListMust provide: size() -> int, insert(int, CardType*), getContentsKnown() -> bool
CardTypeMust provide: setId(int), setCardRef(CardRefType), resetState(bool), setVisible(bool)
Parameters
keepAnnotationsForwarded to card->resetState(). Stack-like zones preserve annotations across zone transitions; hand-like zones clear them.
Here is the call graph for this function:
Here is the caller graph for this function: