summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Army.java22
-rw-r--r--core/src/ch/asynk/tankontank/engine/Faction.java6
-rw-r--r--core/src/ch/asynk/tankontank/engine/HeadedPawn.java4
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java12
-rw-r--r--core/src/ch/asynk/tankontank/game/Army.java29
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/Factory.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/Player.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java1
9 files changed, 43 insertions, 34 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Army.java b/core/src/ch/asynk/tankontank/engine/Army.java
deleted file mode 100644
index 878fe89..0000000
--- a/core/src/ch/asynk/tankontank/engine/Army.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package ch.asynk.tankontank.engine;
-
-public enum Army
-{
- GE("German"),
- US("US"),
- USSR("Soviet"),
- EN("English");
-
- private String s;
- Army(String s) { this.s = s; }
-
- public boolean isEnemy(Army other)
- {
- return (this != other);
- }
-
- public String toString()
- {
- return s;
- }
-}
diff --git a/core/src/ch/asynk/tankontank/engine/Faction.java b/core/src/ch/asynk/tankontank/engine/Faction.java
new file mode 100644
index 0000000..c697894
--- /dev/null
+++ b/core/src/ch/asynk/tankontank/engine/Faction.java
@@ -0,0 +1,6 @@
+package ch.asynk.tankontank.engine;
+
+public interface Faction
+{
+ public boolean isEnemy(Faction other);
+}
diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
index 8965a6e..cbe4cd5 100644
--- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
+++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
@@ -14,9 +14,9 @@ public abstract class HeadedPawn extends Pawn
private Image head;
protected Orientation orientation;
- public HeadedPawn(Army army, TextureAtlas atlas, String pawn, String head)
+ public HeadedPawn(Faction faction, TextureAtlas atlas, String pawn, String head)
{
- super(army, atlas, pawn);
+ super(faction, atlas, pawn);
this.head = new Image(atlas.findRegion(head));
this.orientation = Orientation.KEEP;
this.descr += " " + orientation;
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index f7bb830..eb5953f 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -34,7 +34,7 @@ public abstract class Pawn implements Moveable, Disposable
private Vector3 position = new Vector3(0f, 0f, 0f);
private Vector3 prevPosition = new Vector3(0f, 0f, 0f);
- protected Army army;
+ protected Faction faction;
protected String descr;
private Image image;
private StackedImages overlays;
@@ -67,9 +67,9 @@ public abstract class Pawn implements Moveable, Disposable
{
}
- public Pawn(Army army, TextureAtlas atlas, String name)
+ public Pawn(Faction faction, TextureAtlas atlas, String name)
{
- this.army = army;
+ this.faction = faction;
this.descr = descr;
this.image = new Image(atlas.findRegion(name));
this.overlays = new StackedImages(atlas);
@@ -87,14 +87,14 @@ public abstract class Pawn implements Moveable, Disposable
image.dispose();
}
- public boolean isEnemy(Army other)
+ public boolean isEnemy(Faction other)
{
- return army.isEnemy(other);
+ return faction.isEnemy(other);
}
public boolean isEnemy(Pawn other)
{
- return army.isEnemy(other.army);
+ return faction.isEnemy(other.faction);
}
public boolean isFlankAttack()
diff --git a/core/src/ch/asynk/tankontank/game/Army.java b/core/src/ch/asynk/tankontank/game/Army.java
new file mode 100644
index 0000000..9e729c6
--- /dev/null
+++ b/core/src/ch/asynk/tankontank/game/Army.java
@@ -0,0 +1,29 @@
+package ch.asynk.tankontank.game;
+
+import ch.asynk.tankontank.engine.Faction;
+
+public enum Army implements Faction
+{
+ GE("German"),
+ US("US"),
+ USSR("Soviet"),
+ EN("English");
+
+ private String s;
+
+ Army(String s) {
+ this.s = s;
+ }
+
+ @Override
+ public boolean isEnemy(Faction other)
+ {
+ return (this != other);
+ }
+
+ @Override
+ public String toString()
+ {
+ return s;
+ }
+}
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index 2a8c99a..ca2ca64 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -3,7 +3,6 @@ package ch.asynk.tankontank.game;
import com.badlogic.gdx.utils.Disposable;
import ch.asynk.tankontank.TankOnTank;
-import ch.asynk.tankontank.engine.Army;
import ch.asynk.tankontank.game.states.StateCommon;
import ch.asynk.tankontank.game.states.StateSelect;
import ch.asynk.tankontank.game.states.StateMove;
diff --git a/core/src/ch/asynk/tankontank/game/Factory.java b/core/src/ch/asynk/tankontank/game/Factory.java
index fe0ffaa..86db346 100644
--- a/core/src/ch/asynk/tankontank/game/Factory.java
+++ b/core/src/ch/asynk/tankontank/game/Factory.java
@@ -9,7 +9,6 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.GridPoint2;
import ch.asynk.tankontank.TankOnTank;
-import ch.asynk.tankontank.engine.Army;
import ch.asynk.tankontank.engine.Board;
import ch.asynk.tankontank.engine.Orientation;
import ch.asynk.tankontank.game.Unit.UnitId;
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java
index d63a3f9..15efea0 100644
--- a/core/src/ch/asynk/tankontank/game/Player.java
+++ b/core/src/ch/asynk/tankontank/game/Player.java
@@ -12,7 +12,6 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import ch.asynk.tankontank.TankOnTank;
-import ch.asynk.tankontank.engine.Army;
import ch.asynk.tankontank.engine.Pawn;
import ch.asynk.tankontank.engine.gfx.Image;
import ch.asynk.tankontank.engine.gfx.Drawable;
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index ce652b2..f047de4 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -3,7 +3,6 @@ package ch.asynk.tankontank.game;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
-import ch.asynk.tankontank.engine.Army;
import ch.asynk.tankontank.engine.Pawn;
import ch.asynk.tankontank.engine.Tile;
import ch.asynk.tankontank.engine.HeadedPawn;