summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-05 16:16:30 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-05 16:16:30 +0100
commitb3caf0b8cdd7f16857dd2d0e29ce4f519e924692 (patch)
treecf7af8d25db669e403b3d71d3a08fef6d2bfda23 /core/src/ch
parent0cbf952846ed77e3175754270fea1698c1e4b6e6 (diff)
downloadRustAndDust-b3caf0b8cdd7f16857dd2d0e29ce4f519e924692.zip
RustAndDust-b3caf0b8cdd7f16857dd2d0e29ce4f519e924692.tar.gz
PosisblePaths: fix cost computation
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/engine/PossiblePaths.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
index f3ad61a..cf97653 100644
--- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
+++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java
@@ -172,16 +172,16 @@ public class PossiblePaths implements Iterable<Vector3>
{
int cost = 0;
boolean roadMarch = true;
- Tile prev = null;
+ Tile prev = from;
for (Tile next : paths.get(i)) {
- if (prev != null) {
- Orientation o = Orientation.fromMove(next.col, next.row, prev.col, prev.row);
- cost += next.costFrom(pawn, o);
- roadMarch &= next.road(o);
- }
+ Orientation o = Orientation.fromMove(next.col, next.row, prev.col, prev.row);
+ cost += next.costFrom(pawn, o);
+ roadMarch &= next.road(o);
prev = next;
}
+ Orientation o = Orientation.fromMove(to.col, to.row, prev.col, prev.row);
+ cost += to.costFrom(pawn, o);
if (roadMarch)
cost -= pawn.getRoadMarchBonus();