From: "Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net>

---
 src/net/sf/freecol/common/model/FreeColObject.java | 13 +++++++++++++
 src/net/sf/freecol/common/model/Specification.java |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/net/sf/freecol/common/model/FreeColObject.java 
b/src/net/sf/freecol/common/model/FreeColObject.java
index 61e359bda86..25a8506f749 100644
--- a/src/net/sf/freecol/common/model/FreeColObject.java
+++ b/src/net/sf/freecol/common/model/FreeColObject.java
@@ -389,6 +389,19 @@ public abstract class FreeColObject
     }
 
     /**
+     * Is any of the given abilities present in this object?
+     *
+     * @param id The object identifier.
+     * @return True if the ability is present.
+     */
+    public final boolean hasAnyAbility(String... abilities) {
+        for (String a : abilities)
+            if (hasAbility(id, null))
+                return true;
+        return false;
+    }
+
+    /**
      * Is an ability present in this object?
      *
      * @param id The object identifier.
diff --git a/src/net/sf/freecol/common/model/Specification.java 
b/src/net/sf/freecol/common/model/Specification.java
index 9a11275f1be..6cf037897c5 100644
--- a/src/net/sf/freecol/common/model/Specification.java
+++ b/src/net/sf/freecol/common/model/Specification.java
@@ -1981,7 +1981,7 @@ public final class Specification {
                                           String... abilities) {
         return transform(allTypes.values(),
                          type -> resultType.isInstance(type)
-                             && any(abilities, a -> type.hasAbility(a)),
+                             && type.hasAnyAbilities(abilities),
                          type -> resultType.cast(type));
     }
 
@@ -1999,7 +1999,7 @@ public final class Specification {
                                              String... abilities) {
         return transform(allTypes.values(),
                          type -> resultType.isInstance(type)
-                             && none(abilities, a -> type.hasAbility(a)),
+                             && !type.hasAnyAbility(abilities),
                          type -> resultType.cast(type));
     }
 
-- 
2.11.0.rc0.7.gbe5a750


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to