From 9424d81a342b9a9ec498689d11ea232951e9be2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 4 May 2016 13:46:48 +0200 Subject: PathBuilder: add buildShortest(Tile) --- core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index 0bb5241..581bb25 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -120,6 +120,19 @@ public class PathBuilder implements Disposable return getPaths().size(); } + public int buildShortest(Tile to) + { + clear(); + this.to = to; + this.distance = board.distance(from, to); + findAllPaths(from, pawn.getMovementPoints(), 0, true); + chooseShortest(); + + // printToErr("paths", getPaths()); + stack.clear(); + return getPaths().size(); + } + private void beSmart() { Tile o = null; -- cgit v1.1-2-g2b99