From 86bc45471088d8faf95dbd2300386e18c6a80f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 4 Jan 2016 16:44:58 +0100 Subject: PathIterator: fix rotation support --- core/src/ch/asynk/rustanddust/engine/PathIterator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/engine/PathIterator.java b/core/src/ch/asynk/rustanddust/engine/PathIterator.java index a3667b4..39b3db4 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathIterator.java +++ b/core/src/ch/asynk/rustanddust/engine/PathIterator.java @@ -9,6 +9,7 @@ import com.badlogic.gdx.math.Vector3; public class PathIterator implements Iterator { private Pawn pawn; + private boolean rotation; private Tile to; private Orientation o; private Orientation orientation; @@ -23,6 +24,7 @@ public class PathIterator implements Iterator this.pawn = pawn; this.to = to; this.tile = from; + this.rotation = (from == to); this.orientation = orientation; this.path = path; this.o = pawn.getOrientation(); @@ -34,7 +36,7 @@ public class PathIterator implements Iterator public boolean hasNext() { int s = path.size(); - if (((s == 0) || (i > s)) && (o == orientation)) + if ((rotation || (i > s)) && (o == orientation)) return false; return true; } @@ -47,7 +49,7 @@ public class PathIterator implements Iterator int s = path.size(); - if ((s == 0) || (i >s)) { + if (rotation || (i > s)) { v.z = orientation.r(); o = orientation; return v; -- cgit v1.1-2-g2b99