From c0a07defa9d083a82d126202fff0746e7e54b7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 27 Jan 2016 15:00:24 +0100 Subject: Battle: ... ok Battle.init() -> Battle.init(Ctrl) and sets the map --- core/src/ch/asynk/rustanddust/game/Battle.java | 2 +- core/src/ch/asynk/rustanddust/game/Ctrl.java | 6 ++---- core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 5 +++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Battle.java b/core/src/ch/asynk/rustanddust/game/Battle.java index df17838..03316bd 100644 --- a/core/src/ch/asynk/rustanddust/game/Battle.java +++ b/core/src/ch/asynk/rustanddust/game/Battle.java @@ -21,7 +21,7 @@ public interface Battle public Position getHudPosition(); - public void init(); + public void init(Ctrl ctrl); public boolean actionDone(); diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index ffb37df..1b21e09 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -69,8 +69,9 @@ public abstract class Ctrl implements Disposable game.ctrl = this; this.game = game; this.battle = battle; - this.map = game.factory.getMap(battle.getMapType()); this.hud = new Hud(game); + battle.init(this); + init(); this.blockMap = false; this.blockHud = false; @@ -91,9 +92,6 @@ public abstract class Ctrl implements Disposable this.stateType = StateType.DONE; StateCommon.set(game); - battle.init(); - init(); - hud.update(); this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index 2a966b3..96ff1d2 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -3,6 +3,7 @@ package ch.asynk.rustanddust.game.battles; import java.util.Random; import java.util.HashMap; +import ch.asynk.rustanddust.game.Ctrl; import ch.asynk.rustanddust.game.Army; import ch.asynk.rustanddust.game.Battle; import ch.asynk.rustanddust.game.Player; @@ -93,9 +94,9 @@ public abstract class BattleCommon implements Battle } @Override - public void init() + public void init(Ctrl ctrl) { - this.map = ctrl.map; + ctrl.map = this.map = factory.getMap(getMapType()); this.usPlayer = factory.getPlayer(Army.US); this.gePlayer = factory.getPlayer(Army.GE); -- cgit v1.1-2-g2b99