From abdf663f5ca8da967874f6d4a1da4e71421619da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 29 Mar 2016 18:01:28 +0200 Subject: Order: add int cost --- core/src/ch/asynk/rustanddust/game/Order.java | 1 + core/src/ch/asynk/rustanddust/game/map/Map4Orders.java | 1 + core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java | 2 ++ 3 files changed, 4 insertions(+) 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 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) { -- cgit v1.1-2-g2b99