diff --git a/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/ExceptOnTerrainOrLayerFilter.java b/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/ExceptOnTerrainOrLayerFilter.java index f8a900fef..69e930a9b 100644 --- a/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/ExceptOnTerrainOrLayerFilter.java +++ b/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/ExceptOnTerrainOrLayerFilter.java @@ -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; diff --git a/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/OnlyOnTerrainOrLayerFilter.java b/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/OnlyOnTerrainOrLayerFilter.java index 704fed79d..d20c2bfa2 100644 --- a/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/OnlyOnTerrainOrLayerFilter.java +++ b/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/panels/OnlyOnTerrainOrLayerFilter.java @@ -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; diff --git a/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/tools/scripts/CreateFilterOp.java b/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/tools/scripts/CreateFilterOp.java index 7f5f0b7d4..f4dcd0214 100644 --- a/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/tools/scripts/CreateFilterOp.java +++ b/WorldPainter/WPCore/src/main/java/org/pepsoft/worldpainter/tools/scripts/CreateFilterOp.java @@ -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.*; /** * @@ -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); @@ -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); @@ -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); @@ -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); @@ -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; } @@ -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; }