From 23d96dcd4d067c8d057903a7b80ffbf50a84fd58 Mon Sep 17 00:00:00 2001 From: Brent <90901032@westernsydney.edu.au> Date: Tue, 12 Sep 2023 11:31:22 +1000 Subject: [PATCH] Fix bug losing constraints --- .../VASSAL/counters/SetPieceProperty.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/counters/SetPieceProperty.java b/vassal-app/src/main/java/VASSAL/counters/SetPieceProperty.java index 8ac55b8a95..6bcc59b5c4 100644 --- a/vassal-app/src/main/java/VASSAL/counters/SetPieceProperty.java +++ b/vassal-app/src/main/java/VASSAL/counters/SetPieceProperty.java @@ -76,10 +76,10 @@ public class SetPieceProperty extends DynamicProperty implements RecursionLimite protected GlobalSetter globalSetter; protected PropertyExpression propertiesFilter; protected boolean restrictRange; - protected boolean fixedRange = true; + protected boolean fixedRange; protected int range; protected String rangeProperty = ""; - protected boolean overrideConstrants = false; + protected boolean overrideConstraints; protected Decorator dec; @@ -145,7 +145,7 @@ public void mySetType(String s) { fixedRange = sd.nextBoolean(true); rangeProperty = sd.nextToken(""); globalSetter.setSelectFromDeckExpression(sd.nextToken("-1")); - overrideConstrants = sd.nextBoolean(false); + overrideConstraints = sd.nextBoolean(false); } @Override @@ -162,7 +162,8 @@ public String myGetType() { se.append(fixedRange); se.append(rangeProperty); se.append(globalSetter.getSelectFromDeckExpression()); - se.append(overrideConstrants); + se.append(overrideConstraints); + return ID + se.getValue(); } @@ -372,22 +373,22 @@ else if (changer instanceof PropertyPrompt) { // @Override public int getMaximumValue() { - return (overrideConstrants || currentDPTarget == null) ? super.getMaximumValue() : currentDPTarget.getMaximumValue(); + return (overrideConstraints || currentDPTarget == null) ? super.getMaximumValue() : currentDPTarget.getMaximumValue(); } @Override public int getMinimumValue() { - return (overrideConstrants || currentDPTarget == null) ? super.getMinimumValue() : currentDPTarget.getMinimumValue(); + return (overrideConstraints || currentDPTarget == null) ? super.getMinimumValue() : currentDPTarget.getMinimumValue(); } @Override public boolean isNumeric() { - return (overrideConstrants || currentDPTarget == null) ? super.isNumeric() : currentDPTarget.isNumeric(); + return (overrideConstraints || currentDPTarget == null) ? super.isNumeric() : currentDPTarget.isNumeric(); } @Override public boolean isWrap() { - return (overrideConstrants || currentDPTarget == null) ? super.isWrap() : currentDPTarget.isWrap(); + return (overrideConstraints || currentDPTarget == null) ? super.isWrap() : currentDPTarget.isWrap(); } @Override @@ -410,7 +411,7 @@ public boolean testEquals(Object o) { if (! Objects.equals(range, c.range)) return false; if (! Objects.equals(fixedRange, c.fixedRange)) return false; if (! Objects.equals(rangeProperty, c.rangeProperty)) return false; - if (! Objects.equals(overrideConstrants, c.overrideConstrants)) return false; + if (! Objects.equals(overrideConstraints, c.overrideConstraints)) return false; return Objects.equals(globalSetter.getSelectFromDeckExpression(), c.globalSetter.getSelectFromDeckExpression()); } @@ -463,7 +464,7 @@ public Ed(final SetPieceProperty m) { nameConfig.setHintKey("Editor.SetPieceProperty.property_name_hint"); controls.add("Editor.SetPieceProperty.property_name", nameConfig); - overrideConfig = new BooleanConfigurer(m.overrideConstrants); + overrideConfig = new BooleanConfigurer(m.overrideConstraints); controls.add("Editor.SetPieceProperty.override_constraints", overrideConfig); numericLabel = new JLabel(Resources.getString("Editor.DynamicProperty.is_numeric"));