From 9e05554fc2356e4e91874f75e9b7dc9603ab8d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 31 Mar 2016 19:52:55 +0200 Subject: Ctrl: code cleanup --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 93e473a..f7a3ae8 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -46,9 +46,9 @@ public abstract class Ctrl implements Disposable public final RustAndDust game; public final Battle battle; + private final StringWriter writer = new StringWriter(2048); private final IterableQueue events = new IterableQueue(4); private final IterableStack freeEvents = new IterableStack(4); - private final StringWriter writer = new StringWriter(2048); public Map map; public Hud hud; @@ -131,25 +131,22 @@ public abstract class Ctrl implements Disposable setState(battle.getState()); + if (synched) { + this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); + return; + } + switch(game.config.loadMode) { case REPLAY_ALL: // TODO REPLAY_ALL break; case REPLAY_LAST: - if (synched) { - this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); - } else { - map.prepareReplayLastTurn(); - setState(StateType.REPLAY); - } + map.prepareReplayLastTurn(); + setState(StateType.REPLAY); break; case LOAD: - if (synched) { - this.hud.notify(battle.toString(), 2, Position.MIDDLE_CENTER, false); - } else { - map.prepareReplayLastAction(); - setState(StateType.REPLAY); - } + map.prepareReplayLastAction(); + setState(StateType.REPLAY); break; } -- cgit v1.1-2-g2b99