diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-04 16:44:58 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-04 16:44:58 +0100 |
commit | 86bc45471088d8faf95dbd2300386e18c6a80f6e (patch) | |
tree | 85eda1f4885bff0e476f15d72b872b145f0452c7 /core/src/ch | |
parent | 4c7a6b39fcec76697a90fba446987bc4a869b824 (diff) | |
download | RustAndDust-86bc45471088d8faf95dbd2300386e18c6a80f6e.zip RustAndDust-86bc45471088d8faf95dbd2300386e18c6a80f6e.tar.gz |
PathIterator: fix rotation support
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathIterator.java | 6 |
1 files 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<Vector3> { private Pawn pawn; + private boolean rotation; private Tile to; private Orientation o; private Orientation orientation; @@ -23,6 +24,7 @@ public class PathIterator implements Iterator<Vector3> 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<Vector3> 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<Vector3> int s = path.size(); - if ((s == 0) || (i >s)) { + if (rotation || (i > s)) { v.z = orientation.r(); o = orientation; return v; |