From 0ee87145f0bb821cbfe045e7aa70ed5a7df9f496 Mon Sep 17 00:00:00 2001 From: Mark Benson <58135975+riverwanderer@users.noreply.github.com> Date: Thu, 21 Sep 2023 08:08:13 +0100 Subject: [PATCH 1/5] 12260-Pre & Post Refresh Hotkeys (#12694) * Pre & Post GHK, always try. Doc updated. --- .../java/VASSAL/build/module/GameRefresher.java | 8 ++++++++ .../ReferenceManual/GameRefresher.adoc | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java index 30f4ac4f97..01c7081342 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -47,6 +47,7 @@ import VASSAL.i18n.Resources; import VASSAL.tools.BrowserSupport; import VASSAL.tools.ErrorDialog; +import VASSAL.tools.NamedKeyStroke; import VASSAL.tools.swing.FlowLabel; import VASSAL.tools.swing.SwingUtils; import net.miginfocom.swing.MigLayout; @@ -340,6 +341,10 @@ public void execute(Set options, Command command) throws IllegalBuildExc } } + // About to commence refreshing the game, allow a custom start... + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalGHKpreRefresh")); + + /* * 2. Build a list in visual order of all stacks, decks, mats and other pieces that need refreshing */ @@ -536,8 +541,11 @@ else if (!decksToDelete.isEmpty()) { log(Resources.getString("GameRefresher.refreshable_decks", refreshable)); log(Resources.getString(options.contains("DeleteOldDecks") ? "GameRefresher.deletable_decks" : "GameRefresher.deletable_decks_2", deletable)); //NON-NLS log(Resources.getString(options.contains("AddNewDecks") ? "GameRefresher.addable_decks" : "GameRefresher.addable_decks_2", addable)); //NON-NLS + } } + // After all refreshing, allow a custom finish... + GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalGHKpostRefresh")); } diff --git a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc index 3e3c115f22..32378753c5 100644 --- a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc +++ b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc @@ -18,7 +18,7 @@ Whenever a piece is created in a VASSAL game, the Id of the definition used to c The Game Refresher works by matching the Id in each piece in the current game to the Id's of all piece definitions in the current module to find the new definition. If a match is found, then the piece is replaced with one created from the new defintion. Then each trait in the new Piece is checked to see if there is an EXACTLY matching trait in the old definition. If an EXACT match is found, then the 'state' of the old trait is copied over (e.g. what is the current layer showing, or current rotation facing). -Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. +Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. In addition to these options, <<#RefreshHotkeys,special hotkeys>> can be used to perform custom maintenance routines which you have designed. [.text-center] image:images/GameRefresher.png[] @@ -61,7 +61,7 @@ Remove Decks from the game that no longer exist in the module. See the <<#DeckRe *Add decks to game which have been added to the module since this game was created (empty deck will be added):*:: -Add Decks to teh game that have been added to the module. See the <<#DeckRefresher,Deck Refresher>> section below for full details. +Add Decks to the game that have been added to the module. See the <<#DeckRefresher,Deck Refresher>> section below for full details. |=== @@ -81,3 +81,12 @@ If you select the _Delete decks_ option, then any deck found in the current game If you select the _Add decks_ option, then any _new_ deck found in the module definition that does not exist in the game being refreshed will be _added_. Note this will not add any _contents_ (e.g., cards) to the deck, it will only add the deck. If you need to add contents you will need to arrange to add them separately, e.g., from a piece palette, or dragged in from some other location. +[#RefreshHotkeys] +==== Pre & Post-Refresh Hotkeys +If this option is checked, the Refresher will trigger special hotkeys. _VassalGHKpreRefresh_ is triggered before refreshing and _VassalGHKpostRefresh_ after refreshing. You may use this feature to perform maintenance that you wish to carry out on Predefined Setup or game files. Potential uses include converting counters or populating a new deck. + +Design and test your maintenance actions carefully. You can use _Refresh Counters_ to do one-off tests. Also, remember that Startup GKCs are not executed during Refresh Predefined Setups. + +After a Refeshing Predefined Setups, save your module as a different file name so you can do re-runs on the original if need be. + +Once you are done, consider disabling or removing the maintenance components so that further refreshes don’t trigger them accidentally. \ No newline at end of file From 65c093305e676f0033215606dabe2b5fd00185fd Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Wed, 27 Sep 2023 13:01:06 +0100 Subject: [PATCH 2/5] fix that send "player x joined as side y" was not sent to other players. --- vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java | 1 + 1 file changed, 1 insertion(+) diff --git a/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java b/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java index 7f7ff90dcf..f2886d5ca4 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java +++ b/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java @@ -496,6 +496,7 @@ public void finish() { if (GameModule.getGameModule().isMultiplayerConnected()) { final Command c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), Resources.getString(GlobalOptions.getInstance().chatterHTMLSupport() ? "PlayerRoster.joined_side_2" : "PlayerRoster.joined_side", GameModule.getGameModule().getPrefs().getValue(GameModule.REAL_NAME), translateSide(newSide))); c.execute(); + GameModule.getGameModule().getServer().sendToOthers(c); } final Add a = new Add(this, GameModule.getActiveUserId(), GlobalOptions.getInstance().getPlayerId(), newSide); From 7cd95ff91c060078908d14893e1b4807157acabd Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Wed, 27 Sep 2023 13:04:27 +0100 Subject: [PATCH 3/5] Revert "12260-Pre & Post Refresh Hotkeys (#12694)" This reverts commit 0ee87145f0bb821cbfe045e7aa70ed5a7df9f496. --- .../java/VASSAL/build/module/GameRefresher.java | 8 -------- .../ReferenceManual/GameRefresher.adoc | 13 ++----------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java index 01c7081342..30f4ac4f97 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -47,7 +47,6 @@ import VASSAL.i18n.Resources; import VASSAL.tools.BrowserSupport; import VASSAL.tools.ErrorDialog; -import VASSAL.tools.NamedKeyStroke; import VASSAL.tools.swing.FlowLabel; import VASSAL.tools.swing.SwingUtils; import net.miginfocom.swing.MigLayout; @@ -341,10 +340,6 @@ public void execute(Set options, Command command) throws IllegalBuildExc } } - // About to commence refreshing the game, allow a custom start... - GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalGHKpreRefresh")); - - /* * 2. Build a list in visual order of all stacks, decks, mats and other pieces that need refreshing */ @@ -541,11 +536,8 @@ else if (!decksToDelete.isEmpty()) { log(Resources.getString("GameRefresher.refreshable_decks", refreshable)); log(Resources.getString(options.contains("DeleteOldDecks") ? "GameRefresher.deletable_decks" : "GameRefresher.deletable_decks_2", deletable)); //NON-NLS log(Resources.getString(options.contains("AddNewDecks") ? "GameRefresher.addable_decks" : "GameRefresher.addable_decks_2", addable)); //NON-NLS - } } - // After all refreshing, allow a custom finish... - GameModule.getGameModule().fireKeyStroke(NamedKeyStroke.of("VassalGHKpostRefresh")); } diff --git a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc index 32378753c5..3e3c115f22 100644 --- a/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc +++ b/vassal-doc/src/main/readme-referencemanual/ReferenceManual/GameRefresher.adoc @@ -18,7 +18,7 @@ Whenever a piece is created in a VASSAL game, the Id of the definition used to c The Game Refresher works by matching the Id in each piece in the current game to the Id's of all piece definitions in the current module to find the new definition. If a match is found, then the piece is replaced with one created from the new defintion. Then each trait in the new Piece is checked to see if there is an EXACTLY matching trait in the old definition. If an EXACT match is found, then the 'state' of the old trait is copied over (e.g. what is the current layer showing, or current rotation facing). -Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. In addition to these options, <<#RefreshHotkeys,special hotkeys>> can be used to perform custom maintenance routines which you have designed. +Problems occur when the definition used to create the piece no longer exists in the module, or if traits are modified slightly so that they no longer EXACTLY match the old piece. There are various options in the Game Refresher dialog that can be used to help match and update these pieces and traits. [.text-center] image:images/GameRefresher.png[] @@ -61,7 +61,7 @@ Remove Decks from the game that no longer exist in the module. See the <<#DeckRe *Add decks to game which have been added to the module since this game was created (empty deck will be added):*:: -Add Decks to the game that have been added to the module. See the <<#DeckRefresher,Deck Refresher>> section below for full details. +Add Decks to teh game that have been added to the module. See the <<#DeckRefresher,Deck Refresher>> section below for full details. |=== @@ -81,12 +81,3 @@ If you select the _Delete decks_ option, then any deck found in the current game If you select the _Add decks_ option, then any _new_ deck found in the module definition that does not exist in the game being refreshed will be _added_. Note this will not add any _contents_ (e.g., cards) to the deck, it will only add the deck. If you need to add contents you will need to arrange to add them separately, e.g., from a piece palette, or dragged in from some other location. -[#RefreshHotkeys] -==== Pre & Post-Refresh Hotkeys -If this option is checked, the Refresher will trigger special hotkeys. _VassalGHKpreRefresh_ is triggered before refreshing and _VassalGHKpostRefresh_ after refreshing. You may use this feature to perform maintenance that you wish to carry out on Predefined Setup or game files. Potential uses include converting counters or populating a new deck. - -Design and test your maintenance actions carefully. You can use _Refresh Counters_ to do one-off tests. Also, remember that Startup GKCs are not executed during Refresh Predefined Setups. - -After a Refeshing Predefined Setups, save your module as a different file name so you can do re-runs on the original if need be. - -Once you are done, consider disabling or removing the maintenance components so that further refreshes don’t trigger them accidentally. \ No newline at end of file From 635bc268b4752368ac93ff374b658e93578d282f Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Thu, 28 Sep 2023 12:24:53 +0100 Subject: [PATCH 4/5] filename extension - minor code doc fix. --- .../src/main/java/VASSAL/tools/filechooser/FileChooser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vassal-app/src/main/java/VASSAL/tools/filechooser/FileChooser.java b/vassal-app/src/main/java/VASSAL/tools/filechooser/FileChooser.java index af7e536e74..2782dc7d85 100644 --- a/vassal-app/src/main/java/VASSAL/tools/filechooser/FileChooser.java +++ b/vassal-app/src/main/java/VASSAL/tools/filechooser/FileChooser.java @@ -117,7 +117,7 @@ else if (mode == FILES_ONLY) { public abstract void resetChoosableFileFilters(); /** - * Selects filename.sav if filename.foo is selected. + * Selects filename.vsav if filename.foo is selected. */ public void selectDotSavFile() { final File file = getSelectedFile(); From 6e7d4480765041c9675d0c76c46835bee0aae33b Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Fri, 29 Sep 2023 00:58:18 +0100 Subject: [PATCH 5/5] remove spurious commit. --- vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java | 1 - 1 file changed, 1 deletion(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java b/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java index f2886d5ca4..7f7ff90dcf 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java +++ b/vassal-app/src/main/java/VASSAL/build/module/PlayerRoster.java @@ -496,7 +496,6 @@ public void finish() { if (GameModule.getGameModule().isMultiplayerConnected()) { final Command c = new Chatter.DisplayText(GameModule.getGameModule().getChatter(), Resources.getString(GlobalOptions.getInstance().chatterHTMLSupport() ? "PlayerRoster.joined_side_2" : "PlayerRoster.joined_side", GameModule.getGameModule().getPrefs().getValue(GameModule.REAL_NAME), translateSide(newSide))); c.execute(); - GameModule.getGameModule().getServer().sendToOthers(c); } final Add a = new Add(this, GameModule.getActiveUserId(), GlobalOptions.getInstance().getPlayerId(), newSide);