summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-01-20 17:03:12 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-01-20 17:03:12 +0100
commit7719aaf6334b0425d42aeb579153c0b86ce613ee (patch)
tree9f8a173c6e5d8b3c2da67fd71f1c771c5b1bf6f0 /core/src/ch/asynk/tankontank/game
parentbe3948fb249ebe2724f3de160b4d9869d165e4e1 (diff)
downloadRustAndDust-7719aaf6334b0425d42aeb579153c0b86ce613ee.zip
RustAndDust-7719aaf6334b0425d42aeb579153c0b86ce613ee.tar.gz
PossiblePaths -> PathBuilder
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java26
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateBreak.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateExit.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateMove.java26
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateRotate.java14
5 files changed, 39 insertions, 39 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 76369af..d0b461b 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -15,7 +15,7 @@ import ch.asynk.tankontank.engine.Move;
import ch.asynk.tankontank.engine.SelectedTile;
import ch.asynk.tankontank.engine.Orientation;
import ch.asynk.tankontank.engine.Meteorology;
-import ch.asynk.tankontank.engine.PossiblePaths;
+import ch.asynk.tankontank.engine.PathBuilder;
import ch.asynk.tankontank.engine.gfx.Animation;
import ch.asynk.tankontank.engine.gfx.animations.AnimationSequence;
import ch.asynk.tankontank.engine.gfx.animations.DiceAnimation;
@@ -36,7 +36,7 @@ public abstract class Map extends Board
private Random rand = new Random();
public final HexSet possibleMoves;
- public final PossiblePaths possiblePaths;
+ public final PathBuilder pathBuilder;
public final UnitList moveableUnits;
public final UnitList possibleTargets;
@@ -124,7 +124,7 @@ public abstract class Map extends Board
setup();
possibleMoves = new HexSet(this, 40);
- possiblePaths = new PossiblePaths(this, 10, 20, 5, 10);
+ pathBuilder = new PathBuilder(this, 10, 20, 5, 10);
moveableUnits = new UnitList(6);
possibleTargets = new UnitList(10);
@@ -144,7 +144,7 @@ public abstract class Map extends Board
super.dispose();
clearAll();
destroy.dispose();
- possiblePaths.dispose();
+ pathBuilder.dispose();
DiceAnimation.free();
PromoteAnimation.free();
FireAnimation.free();
@@ -154,7 +154,7 @@ public abstract class Map extends Board
{
possibleMoves.clear();
possibleTargets.clear();
- possiblePaths.clear();
+ pathBuilder.clear();
moveableUnits.clear();
engagementAssists.clear();
activatedUnits.clear();
@@ -190,9 +190,9 @@ public abstract class Map extends Board
return collectPossibleMoves(unit, possibleMoves.asTiles());
}
- public int togglePossiblePathHex(Hex hex)
+ public int togglePathBuilderHex(Hex hex)
{
- return possiblePaths.toggleCtrlTile(hex);
+ return pathBuilder.toggleCtrlTile(hex);
}
public int collectPossibleTargets(Unit unit, UnitList foes)
@@ -328,7 +328,7 @@ public abstract class Map extends Board
// unit.reset();
// }
- return process(unit, possiblePaths.getExitMove());
+ return process(unit, pathBuilder.getExitMove());
}
public void promoteUnit(final Player player, final Unit unit)
@@ -350,7 +350,7 @@ public abstract class Map extends Board
public int moveUnit(Unit unit)
{
- return process(unit, possiblePaths.getMove());
+ return process(unit, pathBuilder.getMove());
}
public void revertMoves()
@@ -556,10 +556,10 @@ public abstract class Map extends Board
public void showPossibleMoves() { possibleMoves.enable(Hex.AREA, true); }
public void hidePossibleMoves() { possibleMoves.enable(Hex.AREA, false); }
- public void showPossiblePaths() { possiblePaths.enable(Hex.AREA, true); }
- public void hidePossiblePaths() { possiblePaths.enable(Hex.AREA, false); }
- public void showPath(Hex dst) { possiblePaths.enable(Hex.MOVE, true); showMove(dst); }
- public void hidePath(Hex dst) { possiblePaths.enable(Hex.MOVE, false); hideMove(dst); }
+ public void showPathBuilder() { pathBuilder.enable(Hex.AREA, true); }
+ public void hidePathBuilder() { pathBuilder.enable(Hex.AREA, false); }
+ public void showPath(Hex dst) { pathBuilder.enable(Hex.MOVE, true); showMove(dst); }
+ public void hidePath(Hex dst) { pathBuilder.enable(Hex.MOVE, false); hideMove(dst); }
public void selectHex(Hex hex) { selectedTile.set(hex); }
public void unselectHex(Hex hex) { selectedTile.hide(); }
diff --git a/core/src/ch/asynk/tankontank/game/states/StateBreak.java b/core/src/ch/asynk/tankontank/game/states/StateBreak.java
index 91fae11..95ca24b 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateBreak.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateBreak.java
@@ -78,9 +78,9 @@ public class StateBreak extends StateCommon
{
if (activeUnit == null) return;
- map.possiblePaths.init(activeUnit);
- if (map.possiblePaths.build(to) == 1) {
- map.possiblePaths.orientation = o;
+ map.pathBuilder.init(activeUnit);
+ if (map.pathBuilder.build(to) == 1) {
+ map.pathBuilder.orientation = o;
map.moveUnit(activeUnit);
ctrl.setAnimationCount(1);
ctrl.setAfterAnimationState(StateType.DONE);
diff --git a/core/src/ch/asynk/tankontank/game/states/StateExit.java b/core/src/ch/asynk/tankontank/game/states/StateExit.java
index f1dadba..f8edf03 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateExit.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateExit.java
@@ -50,13 +50,13 @@ public class StateExit extends StateCommon
Hex hex = unit.getHex();
if (selectedHex == hex)
- map.possiblePaths.build(hex);
+ map.pathBuilder.build(hex);
- Hex exitHex = (Hex) map.possiblePaths.to;
+ Hex exitHex = (Hex) map.pathBuilder.to;
if (!exitZone.contains(exitHex))
throw new RuntimeException(String.format("%s not in exitZone", exitHex));
- map.possiblePaths.setExit(exitZone.orientation);
+ map.pathBuilder.setExit(exitZone.orientation);
unit.hideMoveable();
if (to != null)
diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java
index fb5be50..4794d35 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java
@@ -15,18 +15,18 @@ public class StateMove extends StateCommon
| (ctrl.cfg.canCancel ? Buttons.ABORT.b : 0));
if (prevState == StateType.ESCAPE) {
- if (map.possiblePaths.size() == 1)
+ if (map.pathBuilder.size() == 1)
ctrl.setState(StateType.ROTATE);
return;
}
- map.possiblePaths.clear();
+ map.pathBuilder.clear();
if (prevState == StateType.SELECT) {
// use selectedHex and selectedUnit
activeUnit = selectedUnit;
activeUnit.showMoveable();
- map.possiblePaths.init(activeUnit);
+ map.pathBuilder.init(activeUnit);
map.collectAndShowMovesAndAssits(activeUnit);
if (to != null) {
// quick move -> replay touchUp
@@ -104,12 +104,12 @@ public class StateMove extends StateCommon
if (to !=null)
map.hidePath(to);
to = null;
- map.possiblePaths.clear();
+ map.pathBuilder.clear();
ctrl.setState(StateType.ROTATE);
return;
}
- int s = map.possiblePaths.size();
+ int s = map.pathBuilder.size();
Unit unit = upHex.getUnit();
@@ -118,7 +118,7 @@ public class StateMove extends StateCommon
changeUnit(unit);
} else if ((s == 0) && map.possibleMoves.contains(upHex)) {
s = collectPaths(upHex);
- } else if (map.possiblePaths.contains(upHex)) {
+ } else if (map.pathBuilder.contains(upHex)) {
s = togglePoint(downHex, s);
}
@@ -142,7 +142,7 @@ public class StateMove extends StateCommon
}
activeUnit = unit;
Hex hex = activeUnit.getHex();
- map.possiblePaths.init(activeUnit, hex);
+ map.pathBuilder.init(activeUnit, hex);
activeUnit.showMoveable();
map.hidePossibleMoves();
map.collectPossibleMoves(activeUnit);
@@ -156,10 +156,10 @@ public class StateMove extends StateCommon
private int collectPaths(Hex hex)
{
to = hex;
- int s = map.possiblePaths.build(to);
+ int s = map.pathBuilder.build(to);
map.showMove(to);
map.hidePossibleMoves();
- map.showPossiblePaths();
+ map.showPathBuilder();
return s;
}
@@ -170,10 +170,10 @@ public class StateMove extends StateCommon
} else if (hex == to) {
//
} else {
- map.hidePossiblePaths();
+ map.hidePathBuilder();
map.togglePathOverlay(hex);
- s = map.togglePossiblePathHex(hex);
- map.showPossiblePaths();
+ s = map.togglePathBuilderHex(hex);
+ map.showPathBuilder();
}
return s;
@@ -184,7 +184,7 @@ public class StateMove extends StateCommon
Zone exitZone = ctrl.battle.getExitZone(unit);
if ((exitZone == null) || !exitZone.contains(hex))
return false;
- if ((unit.getHex() != hex) && !map.possiblePaths.canExit(exitZone.orientation))
+ if ((unit.getHex() != hex) && !map.pathBuilder.canExit(exitZone.orientation))
return false;
ctrl.setState(StateType.ESCAPE);
return true;
diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
index 4331d3d..6b60dfb 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
@@ -20,13 +20,13 @@ public class StateRotate extends StateCommon
if (to == null)
to = activeUnit.getHex();
- if (!map.possiblePaths.isSet()) {
- map.possiblePaths.init(activeUnit);
- map.possiblePaths.build(to);
+ if (!map.pathBuilder.isSet()) {
+ map.pathBuilder.init(activeUnit);
+ map.pathBuilder.build(to);
}
- if (map.possiblePaths.size() != 1)
- TankOnTank.debug("ERROR: possiblePaths.size() == " + map.possiblePaths.size());
+ if (map.pathBuilder.size() != 1)
+ TankOnTank.debug("ERROR: pathBuilder.size() == " + map.pathBuilder.size());
rotateOnly = (to == activeUnit.getHex());
@@ -45,7 +45,7 @@ public class StateRotate extends StateCommon
map.hidePath(to);
map.hideDirections(to);
map.hideOrientation(to);
- map.possiblePaths.clear();
+ map.pathBuilder.clear();
to = null;
}
@@ -97,7 +97,7 @@ public class StateRotate extends StateCommon
if (!activeUnit.justEntered() && rotateOnly && (o == activeUnit.getOrientation()))
return;
- map.possiblePaths.orientation = o;
+ map.pathBuilder.orientation = o;
rotationSet = true;
if (ctrl.cfg.mustValidate) {