diff --git a/vassal-app/src/main/java/VASSAL/build/GpIdChecker.java b/vassal-app/src/main/java/VASSAL/build/GpIdChecker.java index f320c034ac..3fbace8e4d 100644 --- a/vassal-app/src/main/java/VASSAL/build/GpIdChecker.java +++ b/vassal-app/src/main/java/VASSAL/build/GpIdChecker.java @@ -23,6 +23,7 @@ import VASSAL.build.widget.PieceSlot; import VASSAL.counters.BasicPiece; import VASSAL.counters.Decorator; +import VASSAL.counters.DynamicProperty; import VASSAL.counters.Embellishment; import VASSAL.counters.FreeRotator; import VASSAL.counters.GamePiece; @@ -89,6 +90,11 @@ public boolean useLayerName() { public boolean useRotateName() { return refresherOptions.contains(GameRefresher.USE_ROTATE_NAME); //$NON-NLS-1$ } + + public boolean useDynamicPropertyName() { + return refresherOptions.contains(GameRefresher.USE_DYNAMICPROPERTY_NAME); //$NON-NLS-1$ + } + public boolean useName() { return refresherOptions.contains(GameRefresher.USE_NAME); //$NON-NLS-1$ } @@ -356,6 +362,14 @@ else if (d instanceof FreeRotator) { } } } + else if (d instanceof DynamicProperty) { + if (useDynamicPropertyName()) { + final String nameToFind = ((DynamicProperty)decoratorNewPc).getDynamicPropertyName(); + if (((DynamicProperty) d).getDynamicPropertyName().equals(nameToFind)) { + return d.myGetState(); + } + } + } } p = d.getInner(); 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 7f35453716..f1e03db960 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java +++ b/vassal-app/src/main/java/VASSAL/build/module/GameRefresher.java @@ -96,6 +96,7 @@ public final class GameRefresher implements CommandEncoder, GameComponent { public static final String USE_LABELER_NAME = "UseLabelerName"; public static final String USE_LAYER_NAME = "UseLayerName"; public static final String USE_ROTATE_NAME = "UseRotateName"; + public static final String USE_DYNAMICPROPERTY_NAME = "UseDynamicPropertyName"; public static final String TEST_MODE = "TestMode"; public static final String DELETE_NO_MAP = "DeleteNoMap"; public static final String REFRESH_DECKS = "RefreshDecks"; @@ -746,6 +747,7 @@ static class RefreshDialog extends JDialog { private JCheckBox labelerNameCheck; private JCheckBox layerNameCheck; private JCheckBox rotateNameCheck; + private JCheckBox dynamicPropertyNameCheck; private JCheckBox deletePieceNoMap; private JCheckBox refreshDecks; private JCheckBox deleteOldDecks; @@ -813,6 +815,8 @@ public void windowClosing(WindowEvent we) { fixGPID = new JCheckBox(Resources.getString("GameRefresher.fix_gpid")); panel.add(fixGPID, "gapx 20"); + dynamicPropertyNameCheck = new JCheckBox(Resources.getString("GameRefresher.use_dynamicProperty_descr"), true); + panel.add(dynamicPropertyNameCheck, "gapx 10"); labelerNameCheck = new JCheckBox(Resources.getString("GameRefresher.use_labeler_descr"), true); panel.add(labelerNameCheck, "gapx 10"); layerNameCheck = new JCheckBox(Resources.getString("GameRefresher.use_layer_descr"), true); @@ -886,6 +890,9 @@ protected void setOptions() { if (rotateNameCheck.isSelected()) { options.add(USE_ROTATE_NAME); //$NON-NLS-1$ } + if (dynamicPropertyNameCheck.isSelected()) { + options.add(USE_DYNAMICPROPERTY_NAME); //$NON-NLS-1$ + } if (testModeOn.isSelected()) { options.add(TEST_MODE); //$NON-NLS-1$ } diff --git a/vassal-app/src/main/java/VASSAL/counters/DynamicProperty.java b/vassal-app/src/main/java/VASSAL/counters/DynamicProperty.java index 61a28cf8e3..fb325529ef 100644 --- a/vassal-app/src/main/java/VASSAL/counters/DynamicProperty.java +++ b/vassal-app/src/main/java/VASSAL/counters/DynamicProperty.java @@ -76,6 +76,8 @@ public class DynamicProperty extends Decorator implements TranslatablePiece, Pro protected String value = ""; + protected String name = Resources.getString("Editor.DynamicProperty.trait_description"); + protected String key; protected boolean numeric; protected int minValue; @@ -99,6 +101,10 @@ public DynamicProperty(String type, GamePiece p) { mySetType(type); } + public String getDynamicPropertyName() { + return name; + } + @Override public void mySetType(String s) { final SequenceEncoder.Decoder sd = new SequenceEncoder.Decoder(s, ';'); diff --git a/vassal-app/src/main/resources/VASSAL/i18n/VASSAL.properties b/vassal-app/src/main/resources/VASSAL/i18n/VASSAL.properties index 6f170f2a31..257a2e187f 100644 --- a/vassal-app/src/main/resources/VASSAL/i18n/VASSAL.properties +++ b/vassal-app/src/main/resources/VASSAL/i18n/VASSAL.properties @@ -705,6 +705,7 @@ GameRefresher.test_mode=Test Mode - Game will not be updated GameRefresher.use_basic_name=Use counter names to identify unknown counters GameRefresher.fire_global_hotkey=After refresh trigger Global Hotkey VassalPostRefreshGHK GameRefresher.fix_gpid=Refreshed counter will adopt matching counter's Piece Id +GameRefresher.use_dynamicProperty_descr=Use property names to match modified Dynamic Property traits GameRefresher.use_labeler_descr=Use Label descriptions to match modified Text Label traits GameRefresher.use_layer_descr=Use Layer names to match modified Layer traits GameRefresher.use_rotate_descr=Use Rotator names to match modified Can Rotate traits