From d51abe4fdc192b1b62d2e5e6a8915f2b3332c863 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 9 Aug 2016 11:07:49 +0200 Subject: [PATCH] Round before casting to int --- .../src/net/osmand/plus/routing/RouteCalculationResult.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index bb68a40f22..6657f04c89 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -302,7 +302,7 @@ public class RouteCalculationResult { int[] listDistance = new int[locations.size()]; listDistance[locations.size() - 1] = 0; for (int i = locations.size() - 1; i > 0; i--) { - listDistance[i - 1] = (int) locations.get(i - 1).distanceTo(locations.get(i)); + listDistance[i - 1] = (int) Math.round(locations.get(i - 1).distanceTo(locations.get(i))); listDistance[i - 1] += listDistance[i]; } @@ -583,7 +583,7 @@ public class RouteCalculationResult { if (listDistance.length > 0) { listDistance[locations.size() - 1] = 0; for (int i = locations.size() - 1; i > 0; i--) { - listDistance[i - 1] = (int) locations.get(i - 1).distanceTo(locations.get(i)); + listDistance[i - 1] = (int) Math.round(locations.get(i - 1).distanceTo(locations.get(i))); listDistance[i - 1] += listDistance[i]; } }