diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-04-12 21:18:10 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-04-12 21:18:10 +0200 |
commit | 165cc4ebe9ec2fbcc8726461522a6dc06219a803 (patch) | |
tree | 5d3755d9d26ef07a59936901a05539915423bf70 /core/src/ch/asynk/rustanddust/game/map | |
parent | cfda2d8f300c672b4d73ad79df3f20888965815d (diff) | |
download | RustAndDust-165cc4ebe9ec2fbcc8726461522a6dc06219a803.zip RustAndDust-165cc4ebe9ec2fbcc8726461522a6dc06219a803.tar.gz |
Unit: id is private
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/map')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java index f13951d..9b51790 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java @@ -82,7 +82,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private void unloadUnit(Json json, Unit unit, boolean pos) { json.writeObjectStart(); - json.writeValue("id", unit.id); + json.writeValue("id", unit.id()); json.writeValue("code", unit.code); json.writeArrayStart("v"); json.writeValue(unit.hq); @@ -174,7 +174,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal if (o.activable.size() > 0) { json.writeArrayStart("a"); for(Unit u : o.activable) - json.writeValue(u.id); + json.writeValue(u.id()); json.writeArrayEnd(); } json.writeObjectEnd(); @@ -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("id", ((Unit) m.pawn).id()); if (m.from != null) { json.writeArrayStart("from"); json.writeValue(m.from.getCol()); @@ -214,12 +214,12 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private void unloadEngageOrder(Json json, Engagement e) { json.writeArrayStart("u"); - json.writeValue(e.attacker.id); - json.writeValue(e.defender.id); + json.writeValue(e.attacker.id()); + json.writeValue(e.defender.id()); json.writeArrayEnd(); json.writeArrayStart("us"); for (Unit u : e.assists) - json.writeValue(u.id); + json.writeValue(u.id()); json.writeArrayEnd(); json.writeArrayStart("d"); json.writeValue(e.d1); @@ -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("id", u.id()); } private void unloadUnit(Json json, String key, Unit u) @@ -253,7 +253,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal { if (key != null) json.writeObjectStart(key); else json.writeObjectStart(); - json.writeValue("id", u.id); + json.writeValue("id", u.id()); Hex h = u.getHex(); if (pos && (h != null)) { json.writeArrayStart("p"); @@ -319,7 +319,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal if (i != -1) u.entryZone = entryZones.get(i); i = a.getInt(5); if (i != -1) u.exitZone = exitZones.get(i); - u.id = unitId; + u.id(unitId); if (pos) { a = v.get("p"); Hex h = getHex(a.getInt(0), a.getInt(1)); @@ -478,7 +478,7 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal private static Unit findById(int id) { for (Unit u : units) { - if (u.id == id) + if (u.id() == id) return u; } RustAndDust.error(String.format("loadPromoteOrder: unable to find unit %d", id)); |