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

---
 .../client/gui/panel/report/ReportCompactColonyPanel.java        | 9 +++------
 src/net/sf/freecol/common/model/Unit.java                        | 8 ++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java 
b/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java
index d4010c5bcc8..77e7789262a 100644
--- a/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java
+++ b/src/net/sf/freecol/client/gui/panel/report/ReportCompactColonyPanel.java
@@ -82,10 +82,6 @@ import static net.sf.freecol.common.util.CollectionUtils.*;
 public final class ReportCompactColonyPanel extends ReportPanel
     implements ActionListener {
 
-    /** Predicate to select units that are not working. */
-    private static final Predicate<Unit> notWorkingPred = u ->
-        u.getState() != Unit.UnitState.FORTIFIED && u.getState() != 
Unit.UnitState.SENTRY;
-
     /** Container class for all the information about a colony. */
     private static class ColonySummary {
 
@@ -205,8 +201,9 @@ public final class ReportCompactColonyPanel extends 
ReportPanel
 
             for (GoodsType gt : goodsTypes) produce(gt);
 
-            this.notWorking.addAll(transform(colony.getTile().getUnits(),
-                                             notWorkingPred));
+            for (Unit u : colony.getTile().getUnits())
+                if (!u.isWorking())
+                    this.notWorking.add(u);
 
             // Collect the types of the units at work in the colony
             // (colony tiles and buildings) that are suboptimal (and
diff --git a/src/net/sf/freecol/common/model/Unit.java 
b/src/net/sf/freecol/common/model/Unit.java
index f288085f91b..13d8b447cf9 100644
--- a/src/net/sf/freecol/common/model/Unit.java
+++ b/src/net/sf/freecol/common/model/Unit.java
@@ -604,6 +604,14 @@ public class Unit extends GoodsLocation
     }
 
     /**
+     * Check whether unit is working (fortified or sentry)
+     */
+    public final boolean isWorking() {
+        return ((state == UnitState.FORTIFIED)
+             || (state == UnitState.SENTRY));
+    }
+
+    /**
      * Checks if a {@code Unit} can get the given state set.
      *
      * @param s The new state for this Unit.  Should be one of
-- 
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