Skip to content

Commit

Permalink
Fix bug losing constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent committed Sep 12, 2023
1 parent 01d4304 commit 23d96dc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions vassal-app/src/main/java/VASSAL/counters/SetPieceProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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();
}

Expand Down Expand Up @@ -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
Expand All @@ -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());
}

Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit 23d96dc

Please sign in to comment.