summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-23 17:29:36 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-23 17:29:36 +0200
commitc53ad74c9b5f405d8f38c8e720ffb65c561cbc06 (patch)
treec6089b22cbf4a95d9ab6cc50c9833a7ab448a00c /core/src/ch/asynk
parenta2feb7e917a4147db4e9ef864edb325aeabad860 (diff)
downloadRustAndDust-c53ad74c9b5f405d8f38c8e720ffb65c561cbc06.zip
RustAndDust-c53ad74c9b5f405d8f38c8e720ffb65c561cbc06.tar.gz
add mapDebug cycling terrain
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index df31c15..dc93236 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -9,6 +9,10 @@ import ch.asynk.tankontank.engine.Pawn;
public abstract class Map extends Board
{
+ private boolean roadsOn = false;
+ private boolean hexOn = false;
+ private Hex.Terrain t = Hex.Terrain.CLEAR;
+
private Pawn currentPawn;
private GridPoint2 currentHex = new GridPoint2(-1, -1);
@@ -47,6 +51,47 @@ public abstract class Map extends Board
if (currentPawn != null) {
pawnsToDraw.remove(currentPawn);
movePawnTo(currentPawn, currentHex);
+ currentPawn = null;
+ } else {
+ debugMap();
+ }
+ }
+
+ private void debugMap()
+ {
+ if (hexOn && (t == Hex.Terrain.CLEAR)) {
+ hexOn = false;
+ } else {
+ hexOn = true;
+ if (roadsOn) {
+ roadsOn = false;
+ t = Hex.Terrain.CLEAR;
+ }
+ else if (t == Hex.Terrain.CLEAR)
+ t = Hex.Terrain.WOODS;
+ else if (t == Hex.Terrain.WOODS)
+ t = Hex.Terrain.HILLS;
+ else if (t == Hex.Terrain.HILLS)
+ t = Hex.Terrain.TOWN;
+ else if (t == Hex.Terrain.TOWN)
+ roadsOn = true;
+ }
+
+ boolean evenRow = true;
+ for (int j = 0; j < cfg.rows; j++) {
+ int c = (evenRow ? cfg.cols : cfg.cols - 1);
+ for (int i = 0; i < c; i++) {
+ Hex hex = getHex(i,j);
+ clearOverlaysOn(i, j);
+ if (hexOn) {
+ if (roadsOn) {
+ if (hex.roads != 0)
+ enableOverlayOn(i, j, 1, true);
+ } else if (hex.terrain == t)
+ enableOverlayOn(i, j, 1, true);
+ }
+ }
+ evenRow = !evenRow;
}
}
}