diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-27 11:06:21 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-27 11:06:21 +0200 |
commit | 9c95a3df50cbddcce92730e750059fb037a3fbb5 (patch) | |
tree | 74e80df8e72ac4a191842afaac5fdfc8e68bf9a3 /core/src/ch | |
parent | 4540ce945002bacec3b45ab2cded8f9946517588 (diff) | |
download | RustAndDust-9c95a3df50cbddcce92730e750059fb037a3fbb5.zip RustAndDust-9c95a3df50cbddcce92730e750059fb037a3fbb5.tar.gz |
Order: add actionId, increased at the end of each action
Diffstat (limited to 'core/src/ch')
4 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java index 9695b92..f55b8fd 100644 --- a/core/src/ch/asynk/rustanddust/game/Map.java +++ b/core/src/ch/asynk/rustanddust/game/Map.java @@ -32,6 +32,7 @@ public abstract class Map extends Map5Marshal public void actionDone() { + incActionId(); game.ctrl.actionDoneCb(); } diff --git a/core/src/ch/asynk/rustanddust/game/Order.java b/core/src/ch/asynk/rustanddust/game/Order.java index 9f24f53..8ab3b03 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 actionId; public OrderType type; public Unit unit; public Move move; diff --git a/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java b/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java index 553834b..e1f08d2 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java @@ -18,6 +18,7 @@ public abstract class Map4Orders extends Map3Animations protected final Battle battle; protected final OrderList orders; + protected int actionId; protected abstract int engagementCost(Engagement e); protected abstract void resolveEngagement(Engagement e); @@ -25,6 +26,7 @@ public abstract class Map4Orders extends Map3Animations { super(game, map, hex); + this.actionId = 0; this.battle = game.ctrl.battle; this.orders = new OrderList(10); } @@ -38,6 +40,7 @@ public abstract class Map4Orders extends Map3Animations Engagement.clearPool(); } + protected void incActionId() { actionId += 1; } protected int ordersSize() { return orders.size(); } protected void ordersClear() { orders.dispose(); } @@ -141,6 +144,7 @@ public abstract class Map4Orders extends Map3Animations } if (r) { + order.actionId = actionId; order.setActivable(activableUnits); orders.add(order); game.ctrl.orderProcessedCb(); diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java index af3cfe6..d6ecae0 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java @@ -158,6 +158,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal for (Order o : orders) { json.writeObjectStart(); json.writeValue("type", o.type); + json.writeValue("aId", o.actionId); switch(o.type) { case MOVE: unloadMoveOrder(json, o.move); @@ -375,6 +376,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal order = loadPromoteOrder(o); break; } + order.actionId = o.getInt("aId"); JsonValue a = o.get("a"); if (a != null) { for (int j = 0; j < a.size; j++) { |