summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-04 16:44:58 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-04 16:44:58 +0100
commit86bc45471088d8faf95dbd2300386e18c6a80f6e (patch)
tree85eda1f4885bff0e476f15d72b872b145f0452c7 /core/src
parent4c7a6b39fcec76697a90fba446987bc4a869b824 (diff)
downloadRustAndDust-86bc45471088d8faf95dbd2300386e18c6a80f6e.zip
RustAndDust-86bc45471088d8faf95dbd2300386e18c6a80f6e.tar.gz
PathIterator: fix rotation support
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/PathIterator.java6
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;