From: "Enrico Weigelt, metux IT consult" <[email protected]>

---
 src/net/sf/freecol/common/model/BuildableType.java | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/net/sf/freecol/common/model/BuildableType.java 
b/src/net/sf/freecol/common/model/BuildableType.java
index f8d55245006..2d947d92bab 100644
--- a/src/net/sf/freecol/common/model/BuildableType.java
+++ b/src/net/sf/freecol/common/model/BuildableType.java
@@ -128,6 +128,13 @@ public abstract class BuildableType extends 
FreeColSpecObjectType {
         requiredAbilities.put(tag, value);
     }
 
+    private boolean checkAnyAvail(FreeColObject[] fco, String key) {
+        for (FreeColObject o : fco)
+            if (o.hasAbility(key))
+                return true;
+        return false;
+    }
+
     /**
      * Is this buildable available to a given FreeColObject?
      *
@@ -135,9 +142,11 @@ public abstract class BuildableType extends 
FreeColSpecObjectType {
      * @return True if the buildable is available.
      */
     public boolean isAvailableTo(FreeColObject... fco) {
-        return (requiredAbilities == null) ? true
-                : all(requiredAbilities.entrySet(),
-                e -> e.getValue() == any(fco, o -> o.hasAbility(e.getKey())));
+        if (requiredAbilities != null)
+            for (Map.Entry<String, Boolean> e : requiredAbilities.entrySet())
+                if (e.getValue() != checkAnyAvail(fco, e.getKey()))
+                    return false;
+        return true;
     }
 
     /**
-- 
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to