diff options
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Order.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map4Orders.java | 8 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java | 12 |
3 files changed, 13 insertions, 13 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Order.java b/core/src/ch/asynk/rustanddust/game/Order.java index 1272c4d..aac0825 100644 --- a/core/src/ch/asynk/rustanddust/game/Order.java +++ b/core/src/ch/asynk/rustanddust/game/Order.java @@ -34,10 +34,10 @@ public class Order implements Disposable, Pool.Poolable, Comparable<Unit> return c; } + public int id; public int cost; - public int orderId; - public OrderType type; public Unit unit; + public OrderType type; public Move move; public Engagement engagement; public UnitList activable = new UnitList(4); @@ -85,7 +85,7 @@ public class Order implements Disposable, Pool.Poolable, Comparable<Unit> @Override public String toString() { - return String.format("[%d] %s : %s", orderId, type, unit.code); + return String.format("[%d] %s : %s", id, type, unit.code); } public void setMove(Unit unit, 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 3a48e4c..e3662e2 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map4Orders.java @@ -120,11 +120,11 @@ public abstract class Map4Orders extends Map3Animations public void prepareReplayLastAction() { int s = orders.size(); - int a = orders.get(s - 1).orderId; + int a = orders.get(s - 1).id; while (s > 0) { s -= 1; Order o = orders.get(s); - if (o.orderId != a) + if (o.id != a) break; replayOrders.add(o); } @@ -188,7 +188,7 @@ public abstract class Map4Orders extends Map3Animations } if (r && !replay) { - order.orderId = orderId; + order.id = orderId; order.setActivable(activableUnits); order.cost = ((activatedUnits.size() > 0) ? ((activableUnits.size() > 0) ? 0 : 1) : 0); orders.add(order); @@ -199,7 +199,7 @@ public abstract class Map4Orders extends Map3Animations activableUnits.clear(); for (Unit u : order.activable) activableUnits.add(u); - orderId = order.orderId; + orderId = order.id; } return r; diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java index 9b51790..9447c38 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java @@ -157,7 +157,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal json.writeArrayStart("orders"); for (Order o : orders) { json.writeObjectStart(); - json.writeValue("oId", o.orderId); + json.writeValue("id", o.id); json.writeValue("type", o.type); json.writeValue("cost", o.cost); switch(o.type) { @@ -185,7 +185,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private void unloadMoveOrder(Json json, Move m) { json.writeValue("mType", m.type); - json.writeValue("id", ((Unit) m.pawn).id()); + json.writeValue("u", ((Unit) m.pawn).id()); if (m.from != null) { json.writeArrayStart("from"); json.writeValue(m.from.getCol()); @@ -241,7 +241,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private void unloadPromoteOrder(Json json, Unit u) { - json.writeValue("id", u.id()); + json.writeValue("u", u.id()); } private void unloadUnit(Json json, String key, Unit u) @@ -366,7 +366,6 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal for (int i = 0; i < v.size; i++) { JsonValue o = v.get(i); Order order = null; - order.orderId = o.getInt("oId"); switch(Order.OrderType.valueOf(o.getString("type"))) { case MOVE: order = loadMoveOrder(o); @@ -378,6 +377,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal order = loadPromoteOrder(o); break; } + order.id = o.getInt("id"); order.cost = o.getInt("cost"); JsonValue a = o.get("a"); if (a != null) { @@ -391,7 +391,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private Order loadMoveOrder(JsonValue v) { - Unit unit = findById(v.getInt("id")); + Unit unit = findById(v.getInt("u")); if (unit == null) return null; Hex from = loadHex(v, "from"); Hex to = loadHex(v, "to"); @@ -460,7 +460,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private Order loadPromoteOrder(JsonValue v) { - Unit unit = findById(v.getInt("id")); + Unit unit = findById(v.getInt("u")); if (unit == null) return null; Order o = Order.get(); |