From: "Enrico Weigelt, metux IT consult" <[email protected]>
---
src/net/sf/freecol/common/model/Settlement.java | 16 +++++++++++++---
src/net/sf/freecol/common/model/Tile.java | 4 ----
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/net/sf/freecol/common/model/Settlement.java
b/src/net/sf/freecol/common/model/Settlement.java
index 04aafe5234b..deb26d6f2d8 100644
--- a/src/net/sf/freecol/common/model/Settlement.java
+++ b/src/net/sf/freecol/common/model/Settlement.java
@@ -326,9 +326,19 @@ public abstract class Settlement extends GoodsLocation
* @return A high seas count, INFINITY if not connected.
*/
public int getHighSeasCount() {
- Tile best = minimize(getTile().getSurroundingTiles(1, 1),
- Tile.isSeaTile, Tile.highSeasComparator);
- return (best == null) ? INFINITY : best.getHighSeasCount();
+ int best_hsc = 0;
+ Tile best_tile = null;
+ for (Tile t : getTile().getSurroundingTiles(1, 1)) {
+ if (!t.isLand() && t.getHighSeasCount() >= 0) {
+ int hsc = t.getHighSeasCount();
+ if (best_tile == null || hsc < best_hsc) {
+ best_tile = t;
+ best_hsc = hsc;
+ }
+ }
+ }
+
+ return (best_tile == null) ? INFINITY : best_hsc;
}
/**
diff --git a/src/net/sf/freecol/common/model/Tile.java
b/src/net/sf/freecol/common/model/Tile.java
index d1e3d205e15..ab0485296ef 100644
--- a/src/net/sf/freecol/common/model/Tile.java
+++ b/src/net/sf/freecol/common/model/Tile.java
@@ -65,10 +65,6 @@ public final class Tile extends UnitLocation implements
Named, Ownable {
public static final Comparator<Tile> highSeasComparator
= Comparator.comparingInt(Tile::getHighSeasCount);
- /** Predicate to identify ordinary sea tiles. */
- public static final Predicate<Tile> isSeaTile = t ->
- !t.isLand() && t.getHighSeasCount() >= 0;
-
/**
* Information that is internal to the native settlements, and only
* updated on close contact.
--
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