From 93228ad6e320029b2e2eaba468e7e77604a6bcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 3 Oct 2014 11:43:06 +0200 Subject: Pawn: rename path -> moves --- core/src/ch/asynk/tankontank/engine/Pawn.java | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 9c7b4d2..582fbfd 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -1,5 +1,6 @@ package ch.asynk.tankontank.engine; +import java.util.Vector; import java.util.ArrayDeque; import com.badlogic.gdx.utils.Disposable; @@ -22,7 +23,7 @@ public abstract class Pawn extends Image implements Disposable private static final float MOVE_TIME = 0.3f; private StackedImages overlays; - private ArrayDeque path = new ArrayDeque(); + private ArrayDeque moves = new ArrayDeque(); public abstract int getMovementPoints(); public abstract int getRoadMarchBonus(); @@ -44,8 +45,8 @@ public abstract class Pawn extends Image implements Disposable public Vector3 getLastPosition() { - if ((path == null) || (path.size() == 0)) return null; - return path.getFirst(); + if ((moves == null) || (moves.size() == 0)) return null; + return moves.getFirst(); } public Orientation getOrientation() @@ -55,9 +56,9 @@ public abstract class Pawn extends Image implements Disposable public void moveDone() { - Vector3 v = path.pop(); - path.clear(); - path.push(v); + Vector3 v = moves.pop(); + moves.clear(); + moves.push(v); } public void pushMove(float x, float y, Orientation o) @@ -65,24 +66,24 @@ public abstract class Pawn extends Image implements Disposable float r = ((o == Orientation.KEEP) ? getRotation() : o.r()); setPosition(x, y, r); Vector3 v = new Vector3(x, y, r); - if ((path.size() == 0) || (!v.equals(path.getFirst()))) - path.push(new Vector3(x, y, r)); + if ((moves.size() == 0) || (!v.equals(moves.getFirst()))) + moves.push(new Vector3(x, y, r)); } public AnimationSequence getResetMovesAnimation() { - final Vector3 finalPos = path.getLast(); + final Vector3 finalPos = moves.getLast(); - AnimationSequence seq = AnimationSequence.get(path.size() + 1); + AnimationSequence seq = AnimationSequence.get(moves.size() + 1); - while(path.size() != 0) { - seq.addAnimation(MoveToAnimation.get(this, path.pop(), MOVE_TIME)); + while(moves.size() != 0) { + seq.addAnimation(MoveToAnimation.get(this, moves.pop(), MOVE_TIME)); } seq.addAnimation(RunnableAnimation.get(this, new Runnable() { @Override public void run() { - path.push(finalPos); + moves.push(finalPos); } })); -- cgit v1.1-2-g2b99