From 98a329b9e709b77a861f532d4ba694dab6093efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 29 Feb 2016 06:52:53 +0100 Subject: Battle,Map5Marshal: add boolean full to unload(...) --- core/src/ch/asynk/rustanddust/game/Battle.java | 2 +- .../asynk/rustanddust/game/battles/BattleCommon.java | 4 ++-- core/src/ch/asynk/rustanddust/game/ctrl/Solo.java | 2 +- .../src/ch/asynk/rustanddust/game/map/Map5Marshal.java | 18 ++++++++++-------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java index 1f82bfb..84a8e78 100644 --- a/core/src/ch/asynk/rustanddust/game/Battle.java +++ b/core/src/ch/asynk/rustanddust/game/Battle.java @@ -35,5 +35,5 @@ public interface Battle public State.StateType getState(); - public String unload(); + public String unload(boolean full); } diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 406e8a1..56c0801 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -57,9 +57,9 @@ public abstract class BattleCommon implements Battle } @Override - public String unload() + public String unload(boolean full) { - return map.unload(getPlayer(), getOpponent()); + return map.unload(full, getPlayer(), getOpponent()); } @Override diff --git a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java index cb90db5..ce52756 100644 --- a/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java +++ b/core/src/ch/asynk/rustanddust/game/ctrl/Solo.java @@ -42,6 +42,6 @@ public class Solo extends Ctrl private void storeState() { - game.db.storeState(gameId, battle.getPlayer().getId(), battle.getOpponent().getId(), battle.unload()); + game.db.storeState(gameId, battle.getPlayer().getId(), battle.getOpponent().getId(), battle.unload(true)); } } diff --git a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java index 5c72394..cc5f3c9 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map5Marshal.java @@ -36,20 +36,22 @@ public abstract class Map5Marshal extends Map4Orders super(game, map, hex); } - public String unload(Player player, Player opponent) + public String unload(boolean full, Player player, Player opponent) { Json json = new Json(OutputType.json); writer.getBuffer().setLength(0); json.setWriter(writer); json.writeObjectStart(); - json.writeObjectStart("map"); - unload(json); - json.writeObjectEnd(); - json.writeArrayStart("players"); - unload(json, player); - unload(json, opponent); - json.writeArrayEnd(); + if (full) { + json.writeObjectStart("map"); + unload(json); + json.writeObjectEnd(); + json.writeArrayStart("players"); + unload(json, player); + unload(json, opponent); + json.writeArrayEnd(); + } json.writeArrayStart("orders"); unload(json, orders); json.writeArrayEnd(); -- cgit v1.1-2-g2b99