summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Order.java4
-rw-r--r--core/src/ch/asynk/tankontank/game/Command.java9
2 files changed, 12 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Order.java b/core/src/ch/asynk/tankontank/engine/Order.java
index 769bed2..681bff2 100644
--- a/core/src/ch/asynk/tankontank/engine/Order.java
+++ b/core/src/ch/asynk/tankontank/engine/Order.java
@@ -1,9 +1,11 @@
package ch.asynk.tankontank.engine;
+import java.lang.Comparable;
+
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.utils.Json;
-public abstract class Order implements Disposable, Pool.Poolable, Json.Serializable
+public abstract class Order implements Disposable, Pool.Poolable, Json.Serializable, Comparable<Pawn>
{
}
diff --git a/core/src/ch/asynk/tankontank/game/Command.java b/core/src/ch/asynk/tankontank/game/Command.java
index 1f79589..1ac1bb5 100644
--- a/core/src/ch/asynk/tankontank/game/Command.java
+++ b/core/src/ch/asynk/tankontank/game/Command.java
@@ -6,6 +6,7 @@ import com.badlogic.gdx.utils.JsonValue;
import ch.asynk.tankontank.engine.Order;
import ch.asynk.tankontank.engine.Move;
+import ch.asynk.tankontank.engine.Pawn;
public class Command extends Order
{
@@ -67,6 +68,14 @@ public class Command extends Order
}
@Override
+ public int compareTo(Pawn pawn)
+ {
+ if (pawn == unit)
+ return 0;
+ return 1;
+ }
+
+ @Override
public String toString()
{
return String.format("%s : %s", type, unit.id);