Class Stack

java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.counters.Stack
All Implemented Interfaces:
PropertySource, GamePiece, StateMergeable, Auditable, ImageSearchTarget
Direct Known Subclasses:
Deck

public class Stack extends AbstractImageFinder implements GamePiece, StateMergeable
A Stack is a collection of pieces in the same location that can often be moved with a single drag-and-drop. Because it implements the GamePiece interface, a Stack is formally a kind of GamePiece itself, which can lead to confusion when the terms pieces, GamePieces, etc are used loosely/interchangeably. The kind of "pieces" a Stack contains are the "regular" kind of pieces that have a BasicPiece plus an optional group of Decorator traits.

A standard Stack will only contain pieces that are "stackable" (i.e. doesn't have a "Does Not Stack" Immobilized trait with stacking disabled, so that Properties.NO_STACK is false) and share the same X/Y position on the same Map, and all stackable pieces on a Map will always be part of some Stack -- even single stackable pieces will have a Stack created to contain them. Stacks should contain only pieces from the same visual layer (see LayeredPieceCollection), but presently bad behaviors can still develop (e.g. a piece uses a Dynamic Property to control its Game Piece Layer, and ends up changing layers without the Stack noticing) -- ideally we should straighten that out in future versions.

Deck is a further extension of Stack which utilizes the piece-grouping code but overrides other aspects (e.g. can allow pieces regardless of their "stackability", has different drag-and-drop behavior, etc) to create a different kind of grouping.