Thanks to Brian supplying some test cases, I have tracked down and fixed 2 issues that affected many (all but me?) users of the Game Refresher.
There where 2 issues, 1 annoying, 1 fatal for most users
-
Place Marker/Replace with Other traits recorded in Prototypes where ‘invisible’ to the Game Refresher and any pieces created by them could never be refreshed. This resulted in the annoying report ‘X pieces could not be refreshed’. In the error log, the reason was reported as ‘Cannot find matching PieceSlot’.
-
There was a bug in the handling of pieces created by Place Marker/Replace by Other traits that could be refreshed that caused them to be replaced by a copy of the piece that created them, not by their own updated definition.
I typically used the Refresher on Scenario setups where no piece have been created by Place/Replace traits yet, so had not seen the problems.
I also changed the reporting of the GamePiece ID check/update process that occurs every time you edit module. This process cross-references all GPID’s (The id that connects a unit on the map to the Vassal definition that defined it) look for missing, invalid or duplicate GPID’s that can be created by naive editing of the buildfile. Any found are allocated new GPID’s. This used to happen silently, but I now report this in the Chat Window so Module Designers get the feedback that this has occured.
Normally, you would only see these messages the first time you edit a module after editing the buildfile and copy/paste/insert unit or prototype definitions without carfully adjusting the GPIDs. Quite a few designers may see some of these messages the first time they edit a module after this fix is applied as Place/Replace traits previously hidden from the Check/Refresh process are assessed for the first time. Theses traits will have correctly allocated GPIDs (if created since Vassal 3.0), and if the buildfile has never been manually edited, should still be valid and not generate any messages.
From this point on, The Refresher should work as expected for all newly created games in modules edited and saved since the patch was applied.
For older save games, the Refresh experience is still going to be somewhat hit and miss. In general, the results should be better than before, but it will depend on the age of the module, the age of the prototypes in the module and buildfile editing history.
I’d like to warn users trying to refresh older save games, but it is not obvious how to accurately detect them. Once an older save game has been refreshed by an updated module, it is good to go from then on.
I don’t think we have any sort of game metadata recorded in the GameState that tells us stuff like the version number of the module or of vassal that created the save. I would actually need to know the version of vassal that the module was saved with that created the save game, if this is < X then I need to warn the user that their may be problems with the refresh process.
It would be fairly easy to add this. GlobalOptions would be a good place, turn it into a CommandEncoder and have it save/load a MetaData command to/from the load files. I can see this being very useful for future compatibility checking.
Thoughts?