Problem with Return to Deck in Predefined Setup

The “Return to Deck” feature in my module works fine but when I save a game after setting up pieces and create a “Pre-Defined Setup”, the same “Return to Deck” feature now does not work. The cards appear face up in the deck stack after initiating “Return to Deck” and causes the VASSAL to freeze up and crash.

They worked perfectly before the game save but when the game save in put into a “Pre-defined Setup” it causes the Vassal to crash.

Any ideas? (I created my “Pre-defined Setup” AFTER all my Vassal work was completed to avoid any difficulties - now it seems the act of saving and putting into a “Pre-defined Setup” is itself a problem?)

Thanks.

I found by trial and error how to solve the problem but implemented TWO changes so can’t say with certainty which one was the culprit.

  1. I checked the previously unchecked box marked “Can be saved-to/loaded-from a file?” in the Deck main box.

  2. Had two prototypes in the cards (actually chits in this case) and each prototype had a duplicate “Return to Deck” command.

Unfortunately will have to redo the Pre-defined Setup and save again (which will take an hour to implement),

Re-doing Pre-defined Setups from scratch seems unavoidable when a change has to implemented - now that would be a great feature - to save an original Pre-defined Setup that incorporates recent changes in the Vassal

I am having the almost exact same problem. When I save a game and reload it, cards that were in a deck are in a pile at the location of the deck but are not in the deck. They are also not stacked.

I ran into this exact problem with Return to Deck not working in predefined setups (I was trying to implement a set of GKCs that would pull certain cards out of a deck and put them in a “Removed from Game” pile if you were playing with less than the full complement of players). The solution was simply to not use Return to Deck at all. Instead, use a Send to Location and specify the exact X/Y coordinates of the destination deck’s location on its map window. The card will in fact become part of the deck this way.

Sounds like a bug because what you were trying to do should work as it doesn’t
sound like anything special that hasn’t been done before.

Could you make a small demo mod of this demonstrating the problem - just a few
card pieces with your GKC/RTD combo Devs can look at.


From: JoelCFC25 jkoepp@yahoo.com
To: messages@vassalengine.org
Sent: Fri, August 17, 2012 8:42:20 AM
Subject: Re: [messages] [Module Design] Problem with Return to Deck in
Predefined Setup

I ran into this exact problem with Return to Deck not working in
predefined setups (I was trying to implement a set of GKCs that would
pull certain cards out of a deck and put them in a “Removed from Game”
pile if you were playing with less than the full complement of players).
The solution was simply to not use Return to Deck at all. Instead, use a
Send to Location and specify the exact X/Y coordinates of the
destination deck’s location on its map window. The card will in fact
become part of the deck this way.


Read this topic online here:
https://forum.vassalengine.org/t/problem-with-return-to-deck-in-predefined-setup/4373/4

I solved the issue by changing the “return to deck” order with a “send to location” order - I will try to recreate the situation in another little example mod

Ok I have recreated it - I don’t know how much of what I did was necessary but I have a tiny little module that is doing what my full module was doing - it is attached - play logfile1 and then close the game like it says and load logfile2 and you will see what it is doing

Thanks for the test module, that helps a lot.
The problems are actually starting earlier than the save file. The very first time you hit the Return button, the card are not actually returning to the Deck, if you right-click on the left hand deck, you get card commands, not the deck commands. They appear to be stacked in the Deck, but aren’t.
Looking into it.
Brent.

Have opened Bug 4705 -Decks behave strangely after loading saved game for this.

Have also resolved this and submitted a bug fix to brent-3.2-New@8279.

This is a bug that has always been there, the same fix can be applied to 3.1.19.

When a Deck of pieces on a map is being created from the saved game, it’s not being correctly associated with the Deck definition from the module. The Deck definition loses track of the pieces that are in it.

The practical result is that after loading a saved game, if you use ‘Return To Deck’ to return a card to a Deck that it is already in, then instead of finding the card already in the Deck and doing nothing, Vassal is removing the piece from the Deck and placing it unstacked in the same location as the Deck.

Once applied, the bug fix should resolve the issue for existing save games, not just new ones.

Brent.

Caveat - It will fix Decks that have all their pieces in them, it will not fix Decks that have unstacked pieces ‘under’ them. These will require the pieces to be placed manually back into the Deck.

Thanks for looking into it!

Thus spake Brent Easton:

Have opened Bug 4705 -Decks behave strangely after loading saved
game
for this.

Have also resolved this and submitted a bug fix to brent-3.2-New@8279.

This is a bug that has always been there, the same fix can be applied to
3.1.19.

When a Deck of pieces on a map is being created from the saved game,
it’s not being correctly associated with the Deck definition from the
module. The Deck definition loses track of the pieces that are in it.

The practical result is that after loading a saved game, if you use
‘Return To Deck’ to return a card to a Deck that it is already in, then
instead of finding the card already in the Deck and doing nothing,
Vassal is removing the piece from the Deck and placing it unstacked in
the same location as the Deck.

Once applied, the bug fix should resolve the issue for existing save
games, not just new ones.

Brent.

Merged to trunk@8284, 3.1@8285.

Try 3.2.0-svn8284 and 3.1.20-svn8287.


J.