diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-29 18:01:28 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-29 18:01:28 +0200 |
commit | abdf663f5ca8da967874f6d4a1da4e71421619da (patch) | |
tree | ca24aa9201b1b37eecd7d640aeba0ca161ce966c | |
parent | 21a2a9b508bd551da64a7017c579730e342f2daa (diff) | |
download | RustAndDust-abdf663f5ca8da967874f6d4a1da4e71421619da.zip RustAndDust-abdf663f5ca8da967874f6d4a1da4e71421619da.tar.gz |
Order: add int cost
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Order.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map4Orders.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Order.java b/core/src/ch/asynk/rustanddust/game/Order.java index 8ab3b03..0c4aa0c 100644 --- a/core/src/ch/asynk/rustanddust/game/Order.java +++ b/core/src/ch/asynk/rustanddust/game/Order.java @@ -34,6 +34,7 @@ public class Order implements Disposable, Pool.Poolable, Comparable<Unit> return c; } + public int cost; public int actionId; public OrderType type; public Unit unit; diff --git a/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java b/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java index ff0e01f..66855ab 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java @@ -191,6 +191,7 @@ public abstract class Map4Orders extends Map3Animations } if (r && !replay) { + order.cost = ((activatedUnits.size() > 0) ? ((activableUnits.size() > 0) ? 0 : 1) : 0); order.actionId = actionId; order.setActivable(activableUnits); orders.add(order); diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java index 979f558..96e6290 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java @@ -159,6 +159,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal json.writeObjectStart(); json.writeValue("type", o.type); json.writeValue("aId", o.actionId); + json.writeValue("cost", o.cost); switch(o.type) { case MOVE: unloadMoveOrder(json, o.move); @@ -376,6 +377,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal order = loadPromoteOrder(o); break; } + order.cost = o.getInt("cost"); order.actionId = o.getInt("aId"); JsonValue a = o.get("a"); if (a != null) { |