summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-27 15:00:24 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-27 22:26:28 +0100
commitc0a07defa9d083a82d126202fff0746e7e54b7cb (patch)
tree99f8ea2d0bb198407645c23284745137407a1985 /core/src/ch/asynk
parent50f542d9a7511fa077541d3416a672c426b11157 (diff)
downloadRustAndDust-c0a07defa9d083a82d126202fff0746e7e54b7cb.zip
RustAndDust-c0a07defa9d083a82d126202fff0746e7e54b7cb.tar.gz
Battle: ... ok Battle.init() -> Battle.init(Ctrl) and sets the map
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Battle.java2
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java6
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java5
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);