summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-05-10 12:58:30 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-05-10 12:58:30 +0200
commit699d99ec7c2fb68cdda77e994d8329f4e1f47df6 (patch)
treea7fa8bae82f195fc53efe47ef9b8e6ec10c07b9a /core/src/ch/asynk
parentb85d0270140b30a6575a2617575dfa1450d2ab61 (diff)
downloadRustAndDust-699d99ec7c2fb68cdda77e994d8329f4e1f47df6.zip
RustAndDust-699d99ec7c2fb68cdda77e994d8329f4e1f47df6.tar.gz
Marshal: add Mode.PLAYER to load currentPlayer AP
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java4
-rw-r--r--core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java6
-rw-r--r--core/src/ch/asynk/rustanddust/util/Marshal.java1
3 files changed, 10 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index 20f6a25..255aa6c 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -102,7 +102,9 @@ public abstract class BattleCommon implements Battle
public void load(Marshal.Mode mode, JsonValue value)
{
- if (mode == Marshal.Mode.PLAYERS) {
+ if (mode == Marshal.Mode.PLAYER) {
+ map.loadPlayerAP(value, 0, currentPlayer);
+ } else if (mode == Marshal.Mode.PLAYERS) {
map.loadPlayers(value, players);
this.currentPlayer = players[0];
} else {
diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java
index d1d7ccc..dc7554f 100644
--- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java
+++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java
@@ -280,6 +280,12 @@ public abstract class Map5Marshal extends Map4Orders implements Marshal
Unit.blockId = false;
}
+ public void loadPlayerAP(JsonValue v, int idx, Player player)
+ {
+ JsonValue a = v.get("players").get(idx).get("v");
+ player.setTurn(a.getInt(0), a.getInt(1), a.getInt(2));
+ }
+
private Player loadPlayer(JsonValue v)
{
Player p = new Player(Army.valueOf(v.getString("a")));
diff --git a/core/src/ch/asynk/rustanddust/util/Marshal.java b/core/src/ch/asynk/rustanddust/util/Marshal.java
index f805fa1..f2e1b47 100644
--- a/core/src/ch/asynk/rustanddust/util/Marshal.java
+++ b/core/src/ch/asynk/rustanddust/util/Marshal.java
@@ -10,6 +10,7 @@ public interface Marshal
PLAYERS,
MAP,
ORDERS,
+ PLAYER,
}
public void unload(Mode mode, Json json);