summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-26 14:58:18 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-26 14:58:18 +0200
commit0acbab87ef7d8d858ace9431d05ad61f7d6b7f38 (patch)
tree4e2b0cd74b9258e7f7f40471c701c56284d0871b
parent98f7cce770ca920e1ce7414aa29937c44140a06a (diff)
downloadRustAndDust-0acbab87ef7d8d858ace9431d05ad61f7d6b7f38.zip
RustAndDust-0acbab87ef7d8d858ace9431d05ad61f7d6b7f38.tar.gz
Orientation: add int allBut(), oppositeSide() -> opposite()
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 6bab3d0..6616b0b 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -28,6 +28,7 @@ public abstract class Board extends Image implements Disposable
{
public enum Orientation
{
+ ALL(0, 63),
KEEP(0, 0),
NORTH(270, 1),
NORTH_EAST(210, 2),
@@ -62,11 +63,16 @@ public abstract class Board extends Image implements Disposable
else return fromSide(s << 1);
}
- public Orientation oppositeSide()
+ public Orientation opposite()
{
return left().left().left();
}
+ public int allBut()
+ {
+ return ALL.s & (s ^ 0xFFFF);
+ }
+
public int getFrontSides()
{
return s | left().s | right().s;
@@ -74,7 +80,7 @@ public abstract class Board extends Image implements Disposable
public int getBackSides()
{
- return oppositeSide().getFrontSides();
+ return opposite().getFrontSides();
}
public static Orientation fromSide(int s)