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

---
 src/net/sf/freecol/common/model/EuropeWas.java | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/net/sf/freecol/common/model/EuropeWas.java 
b/src/net/sf/freecol/common/model/EuropeWas.java
index 4f90c235880..a332ad56c74 100644
--- a/src/net/sf/freecol/common/model/EuropeWas.java
+++ b/src/net/sf/freecol/common/model/EuropeWas.java
@@ -59,9 +59,20 @@ public class EuropeWas {
      * @return The newest {@code Unit} or null if none has been added.
      */
     public Unit getNewUnit() {
-        return (europe.getUnitCount() <= this.unitCount) ? null
-            : maximize(europe.getUnits(),
-                       cachingIntComparator(Unit::getIdNumber));
+        if (europe.getUnitCount() <= this.unitCount)
+            return null;
+
+        int max_id = 0;
+        Unit max_unit = null;
+        for (Unit u : europe.getUnits()) {
+            int uid = u.getIdNumber();
+            if (uid > max_id) {
+                max_id = uid;
+                max_unit = u;
+            }
+        }
+
+        return max_unit;
     }
 
     /**
-- 
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