diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-22 15:56:04 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-22 15:56:04 +0100 |
commit | 3e130a66edfb9ba072f1e1ca4f61bb3cfb114033 (patch) | |
tree | b3935d0e874ed7048e3ab67c17fc98155561200a /core/src/ch/asynk/rustanddust/game/battles | |
parent | c822ee999fd7aea0f796b732ba8e458304c728a7 (diff) | |
download | RustAndDust-3e130a66edfb9ba072f1e1ca4f61bb3cfb114033.zip RustAndDust-3e130a66edfb9ba072f1e1ca4f61bb3cfb114033.tar.gz |
Battle,Ctrl: move JSON code from BattleCommon to Ctrl
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/battles')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 968c657..eef5cc7 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -1,12 +1,9 @@ package ch.asynk.rustanddust.game.battles; import java.util.Random; -import java.io.StringWriter; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonValue; -import com.badlogic.gdx.utils.JsonReader; -import com.badlogic.gdx.utils.JsonWriter.OutputType; import ch.asynk.rustanddust.util.Marshal; import ch.asynk.rustanddust.game.Battle; @@ -25,8 +22,6 @@ public abstract class BattleCommon implements Battle { protected final static Random random = new Random(System.currentTimeMillis()); - private final static StringWriter writer = new StringWriter(2048); - protected final Factory factory; protected int _id; @@ -105,15 +100,6 @@ public abstract class BattleCommon implements Battle map.turnDone(); } - @Override - public void load(Marshal.Mode mode, String payload) - { - JsonValue root = new JsonReader().parse(payload); - load(mode, root); - this.currentPlayer = players[0]; - } - - @Override public void load(Marshal.Mode mode, JsonValue value) { if((mode == Marshal.Mode.FULL) || (mode == Marshal.Mode.STATE)) { @@ -122,17 +108,7 @@ public abstract class BattleCommon implements Battle map.loadPlayers(value, players); } map.load(mode, value); - } - - @Override - public String unload(Marshal.Mode mode) - { - Json json = new Json(OutputType.json); - writer.getBuffer().setLength(0); - json.setWriter(writer); - unload(mode, json); - writer.flush(); - return writer.toString(); + this.currentPlayer = players[0]; } @Override |