From 0a29df80d0b7631b58e5235cf0006158d474d4a0 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Wed, 11 May 2011 13:23:46 +0000 Subject: [PATCH] Distance was not summed up correctly --- Plugins/JSONDescriptor.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Plugins/JSONDescriptor.h b/Plugins/JSONDescriptor.h index 13c439e7e..c6cfdb02a 100644 --- a/Plugins/JSONDescriptor.h +++ b/Plugins/JSONDescriptor.h @@ -163,7 +163,9 @@ public: omitted++; } if(nextID == nameID) { - tempDist += ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon); + double _dist = ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon); + tempDist += _dist; + entireDistance += _dist; } else { if(type == 0 && prevType != 0) routeInstructionString += ",enter motorway and "; @@ -173,8 +175,9 @@ public: if(nameID != 0) routeInstructionString += sEngine->GetEscapedNameForNameID(nameID); routeInstructionString += "\","; - distanceOfInstruction += ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon)+tempDist; - entireDistance += distanceOfInstruction; + double _dist = ApproximateDistance(previous.lat, previous.lon, current.lat, current.lon); + distanceOfInstruction += _dist + tempDist; + entireDistance += _dist; intNumberString.str(""); intNumberString << 10*(round(distanceOfInstruction/10.));; routeInstructionString += intNumberString.str(); @@ -223,6 +226,7 @@ public: lastAngle = angle; tempDist = 0; prevType = type; + distanceOfInstruction = 0; durationOfInstruction = 0; } nameID = nextID;