summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-02-18 21:22:00 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-02-18 21:22:00 +0100
commit50c7bb777aa3608a359d196fe26ef2cdd63db76d (patch)
tree42ca664cadfbcf4eec498766086d7b2ba9484a08 /core/src/ch/asynk/tankontank
parent13bac1f16fb2706320943a397bdd2ffdf9aaba71 (diff)
downloadRustAndDust-50c7bb777aa3608a359d196fe26ef2cdd63db76d.zip
RustAndDust-50c7bb777aa3608a359d196fe26ef2cdd63db76d.tar.gz
Command: implements Comparable<Pawn>
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-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);