From 80245aa6e0ab38354a488ff91ce068e27b6acbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 30 Mar 2016 08:20:50 +0200 Subject: Ctrl: nextState == StateType.DONE -> call complete() and handle REPLAY --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index bc44fd9..522b562 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -275,10 +275,7 @@ public abstract class Ctrl implements Disposable if (nextState == StateType.ABORT) nextState = abortAction(); else if (nextState == StateType.DONE) { - if (stateType == StateType.DEPLOYMENT) - nextState = completeDeployment(); - else - nextState = completeAction(); + nextState = complete(); } if (stateType == StateType.ANIMATION) { @@ -302,6 +299,18 @@ public abstract class Ctrl implements Disposable turnDone(); } + private StateType complete() + { + switch(stateType) { + case DEPLOYMENT: + return completeDeployment(); + case REPLAY: + return battle.getState(); + default: + return completeAction(); + } + } + private StateType completeDeployment() { if (battle.isDeploymentDone()) -- cgit v1.1-2-g2b99