From 9b79116e69a318f0cf45f2d69d2f505a8dbb4835 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Wed, 18 Feb 2015 21:01:17 +0100 Subject: Move: isEnter(), isSet(), isRegular(), isFinal() --- core/src/ch/asynk/tankontank/engine/Move.java | 14 ++++++++++++-- core/src/ch/asynk/tankontank/engine/Pawn.java | 8 ++++---- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'core/src/ch/asynk/tankontank/engine') diff --git a/core/src/ch/asynk/tankontank/engine/Move.java b/core/src/ch/asynk/tankontank/engine/Move.java index 2f0c1389..06035c39 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 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 7e0f9da3..b4714064 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) -- cgit v1.2.3