summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-30 17:35:37 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-30 17:35:37 +0200
commite66abf40b77d601b78b15ca775bbfbdbc45a4bf3 (patch)
treecf2c703af6bdbee0a0ea02f2b02dbea9ac0d1c95 /core/src/ch/asynk/rustanddust
parenta9b5874573c9829ca6350143b9f833ffea6bd0c5 (diff)
downloadRustAndDust-e66abf40b77d601b78b15ca775bbfbdbc45a4bf3.zip
RustAndDust-e66abf40b77d601b78b15ca775bbfbdbc45a4bf3.tar.gz
Ctrl: add setState loop and depth detection
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java10
1 files changed, 10 insertions, 0 deletions
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()