Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ public float modifyStrength(int x, int y, float strength) {
}
break;
case INT_LAYER_EQUAL:
if (dimension.getLayerValueAt(layer, x, y) != value) {
if (dimension.getLayerValueAt(layer, x, y) == value) {
return 0.0f;
}
break;
case INT_LAYER_EQUAL_OR_HIGHER:
if (dimension.getLayerValueAt(layer, x, y) < value) {
if (dimension.getLayerValueAt(layer, x, y) >= value) {
return 0.0f;
}
break;
case INT_LAYER_EQUAL_OR_LOWER:
if (dimension.getLayerValueAt(layer, x, y) > value) {
if (dimension.getLayerValueAt(layer, x, y) <= value) {
return 0.0f;
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ public float modifyStrength(int x, int y, float strength) {
}
break;
case INT_LAYER_EQUAL:
if (dimension.getLayerValueAt(layer, x, y) == value) {
if (dimension.getLayerValueAt(layer, x, y) != value) {
return 0.0f;
}
break;
case INT_LAYER_EQUAL_OR_HIGHER:
if (dimension.getLayerValueAt(layer, x, y) >= value) {
if (dimension.getLayerValueAt(layer, x, y) < value) {
return 0.0f;
}
break;
case INT_LAYER_EQUAL_OR_LOWER:
if (dimension.getLayerValueAt(layer, x, y) <= value) {
if (dimension.getLayerValueAt(layer, x, y) > value) {
return 0.0f;
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
import org.pepsoft.worldpainter.panels.DefaultFilter.LayerValue;
import org.pepsoft.worldpainter.panels.TerrainOrLayerFilter;

import static org.pepsoft.worldpainter.panels.DefaultFilter.Condition.HIGHER_THAN_OR_EQUAL;
import static org.pepsoft.worldpainter.panels.DefaultFilter.Condition.LOWER_THAN_OR_EQUAL;
import static org.pepsoft.worldpainter.panels.DefaultFilter.Condition.*;

/**
*
Expand Down Expand Up @@ -100,7 +99,7 @@ public CreateFilterOp orHigher() throws ScriptException {
if (exceptOnLastSet) {
if (exceptOn instanceof Layer) {
throw new ScriptException("No \"except on\" layer value specified for \"or higher\"");
} else if (((LayerValue) exceptOn).condition != null) {
} else if (((LayerValue) exceptOn).condition != null && ((LayerValue) exceptOn).condition != EQUAL) {
throw new ScriptException("Only one of \"or lower\" and \"or higher\" may be specified for \"except on\" value");
}
exceptOn = new LayerValue(((LayerValue) exceptOn).layer, ((LayerValue) exceptOn).value, HIGHER_THAN_OR_EQUAL);
Expand All @@ -109,7 +108,7 @@ public CreateFilterOp orHigher() throws ScriptException {
throw new ScriptException("No \"only on\" layer specified for \"or higher\"");
} else if (onlyOn instanceof Layer) {
throw new ScriptException("No \"only on\" layer value specified for \"or higher\"");
} else if (((LayerValue) onlyOn).condition != null) {
} else if (((LayerValue) onlyOn).condition != null && ((LayerValue) onlyOn).condition != EQUAL) {
throw new ScriptException("Only one of \"or lower\" and \"or higher\" may be specified for \"only on\" value");
}
onlyOn = new LayerValue(((LayerValue) onlyOn).layer, ((LayerValue) onlyOn).value, HIGHER_THAN_OR_EQUAL);
Expand All @@ -121,7 +120,7 @@ public CreateFilterOp orLower() throws ScriptException {
if (exceptOnLastSet) {
if (exceptOn instanceof Layer) {
throw new ScriptException("No \"except on\" layer value specified for \"or lower\"");
} else if (((LayerValue) exceptOn).condition != null) {
} else if (((LayerValue) exceptOn).condition != null && ((LayerValue) exceptOn).condition != EQUAL) {
throw new ScriptException("Only one of \"or lower\" and \"or higher\" may be specified for \"except on\" value");
}
exceptOn = new LayerValue(((LayerValue) exceptOn).layer, ((LayerValue) exceptOn).value, LOWER_THAN_OR_EQUAL);
Expand All @@ -130,7 +129,7 @@ public CreateFilterOp orLower() throws ScriptException {
throw new ScriptException("No \"only on\" layer specified for \"or lower\"");
} else if (onlyOn instanceof Layer) {
throw new ScriptException("No \"only on\" layer value specified for \"or lower\"");
} else if (((LayerValue) onlyOn).condition != null) {
} else if (((LayerValue) onlyOn).condition != null && ((LayerValue) onlyOn).condition != EQUAL) {
throw new ScriptException("Only one of \"or lower\" and \"or higher\" may be specified for \"only on\" value");
}
onlyOn = new LayerValue(((LayerValue) onlyOn).layer, ((LayerValue) onlyOn).value, LOWER_THAN_OR_EQUAL);
Expand All @@ -151,7 +150,7 @@ public CreateFilterOp onlyOnAutoBiome(int biomeIndex) throws ScriptException {
if (onlyOn != null) {
throw new ScriptException("Only one \"only on\" or condition may be specified");
}
onlyOn = new LayerValue(Biome.INSTANCE, -biomeIndex);;
onlyOn = new LayerValue(Biome.INSTANCE, -biomeIndex);
exceptOnLastSet = false;
return this;
}
Expand Down Expand Up @@ -214,7 +213,7 @@ public CreateFilterOp exceptOnAutoBiome(int biomeIndex) throws ScriptException {
if (exceptOn != null) {
throw new ScriptException("Only one or \"except on\" condition may be specified");
}
exceptOn = new LayerValue(Biome.INSTANCE, -biomeIndex);;
exceptOn = new LayerValue(Biome.INSTANCE, -biomeIndex);
exceptOnLastSet = true;
return this;
}
Expand Down