Skip to content

Commit

Permalink
PDS refresh improved controls with GHK feature (#12898)
Browse files Browse the repository at this point in the history
* Experimental VassalRefreshGHK.

* Experimental VassalRefreshGHK; corrected level; was firing only with decks option.

* Added doc to Refresh Counters section.

* Refresh hotkeys - pre as well as post. Opt-in checkbox.

* re-try build

* re-try build

* re-try build

* re-try build

* Pre & Post GHK, always try. No control checkbox.

* Pre & Post GHK, always try.  Doc updated

* Resubmit.

* Pre and post refresh GHK with control via Refresher panels. Single refresh is opt-in, PDS referesh is opt-out. Deck refresh options are formatted to distinguish them from main options.

* Correction to make use hotkeys check work.

* Updates to documentation for refresher.

* Updates to documentation for refresher.

* Make delete no map pieces default (consistent with Refresh Counters). Rationalise option settings. Attempt to close (dispose) options window at the end of processing.

* Close (dispose) options window at the end of PDS refresh. Indent & format (deck) sub-options. Make delete no map pieces default (consistent with Refresh Counters). Rationalise option settings & use constants always. Doc spelling & grammar tweaks.

* Remove test code that limits number of PDS refreshes. Merge in code cleanup.

* Predefined setup can do a sample run (filtered to reduce the number of PDS to be processed). For module development.

* Indent deck options in ref manual.

* Indent deck options in ref manual.

* Make dirty if a PDS refresh happens (ensure a save prompt). Add regex Pattern null proteciton.

* Add PDS refresh alert sound option, end of process warnings summary and technical stats. Tidy up the control panels.

* Add PDS refresh alert sound option, end of process warnings summary and technical stats. Tidy up the control panels.

* Retain deprecate refresh method.

* Pass not owned and not visible counts back to PDS Refresh. Display error status in window bar.

* Pass not owned and not visible counts back to PDS Refresh. Display error status in window bar.

* Amend progress string.

* Amend progress string.

* PMD

* PMD & Type warning corrections

* PMD & Type warning corrections

* Tidy up logical flow of refresh control panels. Warnings pass.

* Tidy up logical flow of refresh control panels. Warnings pass.

* Tidy up logical flow of refresh control panels. Warnings pass. Disable (perhaps temporarily) a couple of features.

* Remove now redundant separator. Another attempt to set window size.

* with cancel option.

* debugging cancel prompt. Try make PDS refresh modal.

* restrict regex adjustment to trailing element only. Revert to original window (super) modal setting.

* Display files in confirmation window.

* PMDs

* Scrollbar exception.

* Scrollbar exception.

* Files list.

* Restructure messagings around the new confirm prompt.

* Give none-found its own window.

* Message text adjustments.

* Message text adjustments. Modify the PDS dialog dispose - suspect in preventing game load.

* Message text adjustments. Remove the PDS dialog dispose - suspect in preventing game load.

* Make all options fields disabled during a refresh run.

* PMDs

* Heading text tweak.

* Skip duplicate should proceed suppressing gamestate setup!

* Refresh started message should be first.

* Now a refresh can be targeted at decks only. The ability to exclude refresh of both pieces and decks will be of more use once Hotkeys feature is added. Piece refresh is still the default.

* Now a refresh can be targeted at decks only. The ability to exclude refresh of both pieces and decks will be of more use once Hotkeys feature is added. Piece refresh is still the default. Removed a redundant array (decks) from GameRefresher which was populated during the Pieces refresh.

* Refresh log tweaks for consistency.

* Split out hotkey options. Implements option for hotkey only runs. Also refresherOptions must now be re-initiatilised between runs (may be a bug in previous versions too).

* Doc updates.

* Squash unwanted caret. Tweak a screenshot.

* Enhanced orphan counter support. Warning / fail end turn summaries by file.

* Enhanced orphan counter support. Warning / fail end turn summaries by file.

* Document Piece Id replacement feature.

* MacOS ignore .DS_Store

* Update to date with master. Fix missing VassalPostRefreshGHK.

* Update to date with master. Fix missing VassalPostRefreshGHK.

* GHK needs some setup that the standard refresh does

* Reverse out the pre-refresh GHK as it can't work reliably without re-working core refresh, if at all. Support reporting via GHK, through an option to suppress routine PDS refresh reporting.

* Correct update to Refresh PDS screenshot.

* Address code review feedback and merge in master updates. Trusting fix to GpidChecker.noGpIdMatch is appropriate and that the related declarations in GameRefresher are also ok (lines 118-124).

* Correct a name.

* Correct a name.

* Maintain cursor in wait state.

* Try very hard to maintain cursor in wait state.

* More tweaks to Cursors.

* Publish the warnings metric (for RefreshPredefinedSetupsDialog) via a public method.

* Publish the warnings metric (for RefreshPredefinedSetupsDialog) via a public method.
  • Loading branch information
riverwanderer authored Jan 13, 2024
1 parent 2e4042d commit e84358c
Show file tree
Hide file tree
Showing 11 changed files with 737 additions and 246 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ out/
target/
releases/
snapshots/

# MacOS
.DS_Store
23 changes: 20 additions & 3 deletions vassal-app/src/main/java/VASSAL/build/GpIdChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class GpIdChecker {

protected GpIdSupport gpIdSupport;
protected int maxId;
protected int noGpIdMatch = 0; // shared to GameRefresher
protected boolean extensionsLoaded = false;
final Map<String, SlotElement> goodSlots = new HashMap<>();
final List<SlotElement> errorSlots = new ArrayList<>();
Expand All @@ -75,6 +76,10 @@ public GpIdChecker(Set<String> options) {
}
}

public int getNoGpIdMatch() {
return noGpIdMatch;
}

public boolean useLabelerName() {
return refresherOptions.contains(GameRefresher.USE_LABELER_NAME); //$NON-NLS-1$
}
Expand All @@ -87,6 +92,9 @@ public boolean useRotateName() {
public boolean useName() {
return refresherOptions.contains(GameRefresher.USE_NAME); //$NON-NLS-1$
}
public boolean fixGPID() {
return refresherOptions.contains(GameRefresher.FIX_GPID); //$NON-NLS-1$
}

/**
* Add a PieceSlot to our cross-reference and any PlaceMarker
Expand Down Expand Up @@ -160,7 +168,7 @@ protected void testGpId(String id, SlotElement element) {
* If this has been called from a ModuleExtension, the GpId is prefixed with
* the Extension Id. Remove the Extension Id and just process the numeric part.
*
* NOTE: If GpIdChecker is being used by the GameRefesher, then there may be
* NOTE: If GpIdChecker is being used by the GameRefresher, then there may be
* extensions loaded, so retain the extension prefix to ensure a correct
* unique slot id check.
*/
Expand Down Expand Up @@ -249,7 +257,8 @@ public GamePiece createUpdatedPiece(GamePiece oldPiece) {
}
}

// Failed to find a slot by gpid, try by matching piece name if option selected
// Failed to find a slot by gpid, try by matching piece name if option selected; always report in summaries
noGpIdMatch++;
if (useName()) {
final String oldPieceName = Decorator.getInnermost(oldPiece).getName();
for (final SlotElement element : goodSlots.values()) {
Expand All @@ -258,11 +267,19 @@ public GamePiece createUpdatedPiece(GamePiece oldPiece) {
if (oldPieceName.equals(gpName)) {
newPiece = element.createPiece(oldPiece, this);
copyState(oldPiece, newPiece);
if (fixGPID()) {
newPiece.setProperty(Properties.PIECE_ID, slotPiece.getProperty(Properties.PIECE_ID));
}
chat("!" + Resources.getString("GpIdChecker.refreshByName", oldPieceName, gpid, slotPiece.getProperty(Properties.PIECE_ID))
+ (fixGPID() ? " <b>" + Resources.getString("GpIdChecker.fixGPID") + "</b>" : ""));
return newPiece;
}
}
chat(GameRefresher.ERROR_MESSAGE_PREFIX + Resources.getString("GpIdChecker.refreshByNameFail", oldPieceName, gpid == null ? "" : gpid));
}
else {
chat(GameRefresher.ERROR_MESSAGE_PREFIX + Resources.getString("GpIdChecker.SlotNotFound", Decorator.getInnermost(oldPiece).getName(), gpid == null ? "" : gpid));
}

return oldPiece;
}

Expand Down
Loading

0 comments on commit e84358c

Please sign in to comment.