Good way to identify that a piece is in a deck? (Bug 13306)

Say I’m processing my way through a DeckVisitorDispatcher block of crud, and I reach a particular GamePiece, and I would like to check if that particular piece “is a member of any Deck” (as opposed to merely being in a Stack, or being not-in-a-stack-or-deck-at-all).

Anybody offhand know a good way to check “is this piece right here currently a member of any decks”?

Because apparently in KeyBufferer when band-selecting of things goes on, even though the little “VisitDeck” handler returns null, that prevents only “The Deck Itself” from being added to the selection, and does NOT prevent all the happy little MEMBERS of the deck from being selected.

If the player band-selects around ONLY the deck, this is harmless, because there’s then nothing “visibly selected” so way to accidentally drag the selected stuff anywhere.

But if the player band-selects around any regular unit/stack AND happens to include a deck in the band-select, THEN DISASTER AWAITS! Because it is now possible for the player to drag that regular unit/stack somewhere the entire contents of the deck will come with it.

I have identify where this processing occurs (in KeyBufferer), but now I need to figure out a way to exclude all the individual items that that are members of a deck, when it comes through the regular PieceVisitor.

Anyone know a zany trick? Would I just look to see if it had a parent, and if that parent “instanceof” Deck?


A piece currently residing in a Deck must have a parent and that parent must be an instanceof Deck.

Ha! I know what I’m going to say has nothing to do with your problem, but I can top it for weirdness!
Make a deck. Add the trait “move fixed distance” to each card, e.g. ^E moves the card 50 pixels east.
Run the vmod. Draw a box around the deck. Hit ^E a few times. The entire deck will move east. Note I did not say “contents.” When I say entire deck, I mean the works–cards AND deck!

Haha Shilinski - I didn’t even know it was possible to move a Deck during play! :slight_smile:

The fix I’m working on should fix the contents moving (because they won’t get band-selected), but I dunno nuthin’ 'bout no decks moving…

p.s. I think it’s awesome that I read down the list here and you’re less then 30 miles from me while Brent is on the other flipping side of the Earth!