From: "Enrico Weigelt, metux IT consult" <[email protected]>
---
src/net/sf/freecol/common/model/Map.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/net/sf/freecol/common/model/Map.java
b/src/net/sf/freecol/common/model/Map.java
index c631ca607e1..8e107169d71 100644
--- a/src/net/sf/freecol/common/model/Map.java
+++ b/src/net/sf/freecol/common/model/Map.java
@@ -658,7 +658,16 @@ public class Map extends FreeColGameObject implements
Location {
* @return The closest tile found (may be null if the list is empty).
*/
public Tile getClosestTile(Tile tile, Collection<Tile> tiles) {
- return minimize(tiles, cachingIntComparator(t -> getDistance(t,
tile)));
+ int min_dist = Integer.MAX_VALUE;
+ Tile best = null;
+ for (Tile t : tiles) {
+ int dist = getDistance(t, tile);
+ if (best == null || dist < min_dist) {
+ best = t;
+ min_dist = dist;
+ }
+ }
+ return best;
}
/**
--
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