diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-04 13:46:48 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-04 13:46:48 +0200 |
commit | 9424d81a342b9a9ec498689d11ea232951e9be2c (patch) | |
tree | f595b717c651a07bbaa0edb945888d88baa032e0 /core/src/ch | |
parent | 07e0efdb469890c4847df38aced61baf12c1ec5b (diff) | |
download | RustAndDust-9424d81a342b9a9ec498689d11ea232951e9be2c.zip RustAndDust-9424d81a342b9a9ec498689d11ea232951e9be2c.tar.gz |
PathBuilder: add buildShortest(Tile)
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 13 |
1 files changed, 13 insertions, 0 deletions
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; |