From e66abf40b77d601b78b15ca775bbfbdbc45a4bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 30 Mar 2016 17:35:37 +0200 Subject: Ctrl: add setState loop and depth detection --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 29c674c..6b5ec1a 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -56,6 +56,7 @@ public abstract class Ctrl implements Disposable public boolean blockHud; private Hex touchedHex; protected boolean synched; + private int depth; private final State selectState; private final State pathState; @@ -102,6 +103,7 @@ public abstract class Ctrl implements Disposable this.blockHud = false; this.touchedHex = null; this.synched = false; + this.depth = 0; this.selectState = new StateSelect(); this.pathState = new StateMove(); @@ -341,6 +343,10 @@ public abstract class Ctrl implements Disposable public void setState(StateType nextState) { + depth += 1; + if (depth > 1) + RustAndDust.debug(String.format("***!!!*** STATE DEPTH : %d", depth)); + if (nextState == StateType.ABORT) nextState = abortAction(); else if (nextState == StateType.DONE) { @@ -355,6 +361,9 @@ public abstract class Ctrl implements Disposable hud.playerInfo.blockEndOfTurn(nextState != StateType.SELECT); + if (nextState == stateType) + RustAndDust.debug(String.format("***!!!*** STATE LOOP : %s", stateType)); + this.state.leaveFor(nextState); this.state = getNextState(nextState); @@ -366,6 +375,7 @@ public abstract class Ctrl implements Disposable if (nextState == StateType.TURN_OVER) turnDone(); + depth -= 1; } private StateType complete() -- cgit v1.1-2-g2b99