fix calculated distance for helpGetRightwardsPath (reused same distance calculate as in helpGetUpwardsPath before)
This commit is contained in:
@@ -251,10 +251,13 @@ struct
|
|||||||
if isReachableFromRight (prevPlat, currentPlat) then
|
if isReachableFromRight (prevPlat, currentPlat) then
|
||||||
(* is reachable, so reach *)
|
(* is reachable, so reach *)
|
||||||
let
|
let
|
||||||
val {y = cy, ...} = currentPlat
|
(* considering horizontal distance only.
|
||||||
val {y = py, ...} = prevPlat
|
* todo: can consider diagonal/vertical distance too
|
||||||
|
* (by pythagoras) *)
|
||||||
|
val {x = cx, ...} = currentPlat
|
||||||
|
val {x = px, ...} = prevPlat
|
||||||
|
|
||||||
val diff = py - cy
|
val diff = cx - px
|
||||||
val platDist = dist + diff
|
val platDist = dist + diff
|
||||||
|
|
||||||
val (newDist, newPath) = getRightwardsPath
|
val (newDist, newPath) = getRightwardsPath
|
||||||
@@ -405,6 +408,10 @@ struct
|
|||||||
else
|
else
|
||||||
let
|
let
|
||||||
val currentPlat = Platform.find (id, platforms)
|
val currentPlat = Platform.find (id, platforms)
|
||||||
|
(* considering vertical distance only.
|
||||||
|
* This is okay because the scan box is a simple square
|
||||||
|
* directly above prev platform which does not care about
|
||||||
|
* top right or top left). *)
|
||||||
val {y = cy, ...} = currentPlat
|
val {y = cy, ...} = currentPlat
|
||||||
val {y = py, ...} = prevPlat
|
val {y = py, ...} = prevPlat
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user