summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-02-18 21:01:17 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-02-18 21:01:17 +0100
commit9b79116e69a318f0cf45f2d69d2f505a8dbb4835 (patch)
tree87b839144acd2ff28b7e3cce45bdde823a6e2a58 /core/src
parent3c7ddc37001bd45522ff78778ea7fcd12b02e3f6 (diff)
downloadRustAndDust-9b79116e69a318f0cf45f2d69d2f505a8dbb4835.zip
RustAndDust-9b79116e69a318f0cf45f2d69d2f505a8dbb4835.tar.gz
Move: isEnter(), isSet(), isRegular(), isFinal()
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Move.java14
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java8
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java4
3 files changed, 18 insertions, 8 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Move.java b/core/src/ch/asynk/tankontank/engine/Move.java
index 2f0c138..06035c3 100644
--- a/core/src/ch/asynk/tankontank/engine/Move.java
+++ b/core/src/ch/asynk/tankontank/engine/Move.java
@@ -98,12 +98,22 @@ public class Move extends Path implements Iterable<Vector3>
movePool.free(this);
}
- public boolean isEntry()
+ public boolean isSet()
+ {
+ return (type == MoveType.SET);
+ }
+
+ public boolean isEnter()
{
return (type == MoveType.ENTER);
}
- public boolean isComplete()
+ public boolean isRegular()
+ {
+ return (type == MoveType.REGULAR);
+ }
+
+ public boolean isFinal()
{
return (type != MoveType.ENTER);
}
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 7e0f9da..b471406 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -113,11 +113,11 @@ public abstract class Pawn implements Moveable, Disposable
public void move(Move move)
{
- if (move.isEntry())
+ if (move.isEnter())
throw new RuntimeException("wrong MoveType");
if (this.move != null) {
- if (this.move.isEntry())
+ if (this.move.isEnter())
this.move.dispose();
else
throw new RuntimeException("try to override an existing move instance");
@@ -128,7 +128,7 @@ public abstract class Pawn implements Moveable, Disposable
public void enter(Move move)
{
- if (!move.isEntry())
+ if (!move.isEnter())
throw new RuntimeException("wrong MoveType");
if (this.move != null)
@@ -152,7 +152,7 @@ public abstract class Pawn implements Moveable, Disposable
public boolean justEntered()
{
- return ((move != null) && move.isEntry());
+ return ((move != null) && move.isEnter());
}
public boolean is(Faction faction)
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index 6105637..a488633 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -286,7 +286,7 @@ public class Unit extends HeadedPawn
public boolean canHQMove()
{
- return (isHq() && ((move == null) || (!move.isEntry())));
+ return (isHq() && ((move == null) || (!move.isEnter())));
}
public void setMoved()
@@ -306,7 +306,7 @@ public class Unit extends HeadedPawn
if (cost > mpLeft)
TankOnTank.debug("ERROR: Movement point exceeded: " + cost + "/" + mpLeft + " please report");
- if (move.isComplete())
+ if (move.isFinal())
setMoved();
mpLeft -= cost;