summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game/states
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/states')
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateBreak.java9
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateCommon.java9
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateEngage.java23
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateMove.java13
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateRotate.java7
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateSelect.java3
6 files changed, 29 insertions, 35 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
index 1555f6b..aff63d0 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateBreak.java
@@ -2,7 +2,6 @@ package ch.asynk.rustanddust.game.states;
import ch.asynk.rustanddust.engine.Orientation;
import ch.asynk.rustanddust.game.Unit;
-import ch.asynk.rustanddust.game.Map.UnitType;
import ch.asynk.rustanddust.game.hud.ActionButtons.Buttons;
import ch.asynk.rustanddust.RustAndDust;
@@ -17,13 +16,13 @@ public class StateBreak extends StateCommon
activeUnit = null;
ctrl.hud.actionButtons.show(Buttons.DONE.b);
ctrl.hud.pushNotify("Break move possible");
- map.unitsShow(UnitType.BREAK_THROUGH);
+ map.unitsBreakThroughShow();
}
@Override
public void leave(StateType nextState)
{
- map.unitsHide(UnitType.BREAK_THROUGH);
+ map.unitsBreakThroughHide();
map.hexMoveHide(to);
map.hexDirectionsHide(to);
if (activeUnit != null) map.hexMoveHide(activeUnit.getHex());
@@ -52,12 +51,12 @@ public class StateBreak extends StateCommon
// TODO : cancel preview move before showing rotation
if (activeUnit == null) {
Unit unit = upHex.getUnit();
- if (map.unitsContains(UnitType.BREAK_THROUGH, unit)) {
+ if (map.unitsBreakThroughContains(unit)) {
activeUnit = unit;
map.hexMoveShow(upHex);
map.hexMoveShow(to);
map.hexDirectionsShow(to);
- map.unitsHide(UnitType.BREAK_THROUGH);
+ map.unitsBreakThroughHide();
}
} else {
o = Orientation.fromAdj(to, upHex);
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateCommon.java b/core/src/ch/asynk/rustanddust/game/states/StateCommon.java
index a2aa490..f56d3a5 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateCommon.java
@@ -1,7 +1,6 @@
package ch.asynk.rustanddust.game.states;
import ch.asynk.rustanddust.game.Map;
-import ch.asynk.rustanddust.game.Map.UnitType;
import ch.asynk.rustanddust.game.Hex;
import ch.asynk.rustanddust.game.Unit;
import ch.asynk.rustanddust.game.Ctrl;
@@ -55,15 +54,15 @@ public abstract class StateCommon implements State
protected void showPossibilities(Unit unit)
{
if (ctrl.cfg.showMoves && unit.canMove()) map.movesShow();
- if (ctrl.cfg.showTargets && unit.canEngage()) map.unitsShow(UnitType.TARGETS);
- if (ctrl.cfg.showMoveAssists && unit.canMove()) map.unitsShow(UnitType.MOVEABLE);
+ if (ctrl.cfg.showTargets && unit.canEngage()) map.unitsTargetShow();
+ if (ctrl.cfg.showMoveAssists && unit.canMove()) map.unitsMoveableShow();
unit.enableOverlay(Unit.MOVE, false);
}
protected void hidePossibilities()
{
map.movesHide();
- map.unitsHide(UnitType.TARGETS);
- map.unitsHide(UnitType.MOVEABLE);
+ map.unitsTargetHide();
+ map.unitsMoveableHide();
}
}
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java
index 1ff4c56..5daf1e8 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java
@@ -1,7 +1,6 @@
package ch.asynk.rustanddust.game.states;
import ch.asynk.rustanddust.game.Unit;
-import ch.asynk.rustanddust.game.Map.UnitType;
import ch.asynk.rustanddust.game.hud.ActionButtons.Buttons;
import ch.asynk.rustanddust.RustAndDust;
@@ -11,16 +10,16 @@ public class StateEngage extends StateCommon
@Override
public void enter(StateType prevState)
{
- map.unitsClear(UnitType.TARGETS);
+ map.unitsTargetClear();
ctrl.hud.actionButtons.show(ctrl.cfg.canCancel ? Buttons.ABORT.b : 0);
// activeUnit is the target
if (prevState == StateType.SELECT) {
activeUnit = null;
// use selectedHex and selectedUnit
- map.unitsHide(UnitType.TARGETS);
+ map.unitsTargetHide();
map.collectTargets(selectedUnit, ctrl.opponent.units);
- map.unitsShow(UnitType.TARGETS);
+ map.unitsTargetShow();
if (to != null) {
// quick fire -> replay touchUp
upHex = to;
@@ -36,8 +35,8 @@ public class StateEngage extends StateCommon
public void leave(StateType nextState)
{
selectedUnit.hideAttack();
- map.unitsHide(UnitType.ASSISTS);
- map.unitsHide(UnitType.TARGETS);
+ map.unitsAssistHide();
+ map.unitsTargetHide();
map.hexUnselect(selectedHex);
if (to != null)
map.hexUnselect(to);
@@ -46,7 +45,7 @@ public class StateEngage extends StateCommon
@Override
public StateType abort()
{
- map.unitsClear(UnitType.ACTIVATED);
+ map.unitsActivatedClear();
return StateType.ABORT;
}
@@ -57,7 +56,7 @@ public class StateEngage extends StateCommon
if (map.engageUnit(selectedUnit, activeUnit)) {
ctrl.player.wonEngagementCount += 1;
ctrl.opponent.casualty(activeUnit);
- if (map.unitsSize(UnitType.BREAK_THROUGH) > 0) {
+ if (map.unitsBreakThroughSize() > 0) {
nextState = StateType.BREAK;
}
} else {
@@ -82,20 +81,20 @@ public class StateEngage extends StateCommon
// activeUnit is the target, selectedTarget is the engagement leader
if (unit == selectedUnit) {
ctrl.setState(StateType.ABORT);
- } else if ((activeUnit == null) && map.unitsContains(UnitType.TARGETS, unit)) {
+ } else if ((activeUnit == null) && map.unitsTargetContains(unit)) {
// ctrl.hud.notify("Engage " + unit);
- map.unitsHide(UnitType.TARGETS);
+ map.unitsTargetHide();
to = upHex;
activeUnit = unit;
activeUnit.showTarget();
map.collectAssists(selectedUnit, activeUnit, ctrl.player.units);
- map.unitsShow(UnitType.ASSISTS);
+ map.unitsAssistShow();
ctrl.hud.actionButtons.show((ctrl.cfg.mustValidate ? Buttons.DONE.b : 0) | (ctrl.cfg.canCancel ? Buttons.ABORT.b : 0));
}
else if (unit == activeUnit) {
ctrl.setState(StateType.DONE);
}
- else if ((activeUnit != null) && map.unitsContains(UnitType.ASSISTS, unit)) {
+ else if ((activeUnit != null) && map.unitsAssistContains(unit)) {
map.toggleAssist(unit);
// if(map.toggleAssist(unit))
// ctrl.hud.notify(unit + " will fire");
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateMove.java b/core/src/ch/asynk/rustanddust/game/states/StateMove.java
index 659b6ab..d601aa6 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateMove.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateMove.java
@@ -3,7 +3,6 @@ package ch.asynk.rustanddust.game.states;
import ch.asynk.rustanddust.game.Hex;
import ch.asynk.rustanddust.game.Unit;
import ch.asynk.rustanddust.game.Zone;
-import ch.asynk.rustanddust.game.Map.UnitType;
import ch.asynk.rustanddust.game.hud.ActionButtons.Buttons;
public class StateMove extends StateCommon
@@ -12,7 +11,7 @@ public class StateMove extends StateCommon
public void enter(StateType prevState)
{
ctrl.hud.actionButtons.show(
- ((map.unitsSize(UnitType.ACTIVATED) > 0) ? Buttons.DONE.b : 0)
+ ((map.unitsActivatedSize() > 0) ? Buttons.DONE.b : 0)
| (ctrl.cfg.canCancel ? Buttons.ABORT.b : 0));
if (prevState == StateType.WITHDRAW) {
@@ -40,7 +39,7 @@ public class StateMove extends StateCommon
if (selectedUnit.canMove()) {
changeUnit(selectedUnit);
} else {
- changeUnit(map.unitsGet(UnitType.MOVEABLE, 0));
+ changeUnit(map.unitsMoveableGet(0));
}
}
@@ -74,7 +73,7 @@ public class StateMove extends StateCommon
map.revertEnter(activeUnit);
return StateType.ABORT;
}
- int n = map.unitsSize(UnitType.ACTIVATED);
+ int n = map.unitsActivatedSize();
if (n == 0)
return StateType.ABORT;
map.revertMoves();
@@ -86,7 +85,7 @@ public class StateMove extends StateCommon
{
hideAssists();
// be sure that the hq is activated
- if (selectedUnit.canMove() && (map.unitsSize(UnitType.ACTIVATED) > 0))
+ if (selectedUnit.canMove() && (map.unitsActivatedSize() > 0))
selectedUnit.setMoved();
return StateType.DONE;
@@ -113,7 +112,7 @@ public class StateMove extends StateCommon
Unit unit = upHex.getUnit();
- if (map.unitsContains(UnitType.MOVEABLE, unit)) {
+ if (map.unitsMoveableContains(unit)) {
if(unit != activeUnit)
changeUnit(unit);
} else if ((s == 0) && map.movesContains(upHex)) {
@@ -130,7 +129,7 @@ public class StateMove extends StateCommon
private void hideAssists()
{
- map.unitsHide(UnitType.MOVEABLE);
+ map.unitsMoveableHide();
}
private void changeUnit(Unit unit)
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateRotate.java b/core/src/ch/asynk/rustanddust/game/states/StateRotate.java
index 5c55a9d..5beddcd 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateRotate.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateRotate.java
@@ -1,7 +1,6 @@
package ch.asynk.rustanddust.game.states;
import ch.asynk.rustanddust.engine.Orientation;
-import ch.asynk.rustanddust.game.Map.UnitType;
import ch.asynk.rustanddust.game.hud.ActionButtons.Buttons;
import ch.asynk.rustanddust.RustAndDust;
@@ -14,7 +13,7 @@ public class StateRotate extends StateCommon
@Override
public void enter(StateType prevState)
{
- ctrl.hud.actionButtons.show((ctrl.cfg.canCancel && (map.unitsSize(UnitType.MOVEABLE) > 1))? Buttons.ABORT.b : 0);
+ ctrl.hud.actionButtons.show((ctrl.cfg.canCancel && (map.unitsMoveableSize() > 1))? Buttons.ABORT.b : 0);
if (activeUnit == null)
activeUnit = selectedUnit;
@@ -57,8 +56,8 @@ public class StateRotate extends StateCommon
if (activeUnit.justEntered()) {
map.revertEnter(activeUnit);
nextState = StateType.ABORT;
- } else if (map.unitsSize(UnitType.ACTIVATED) == 0) {
- map.unitsHide(UnitType.MOVEABLE);
+ } else if (map.unitsActivatedSize() == 0) {
+ map.unitsMoveableHide();
} else {
nextState = StateType.MOVE;
}
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java
index 3ec2274..d7738c4 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateSelect.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateSelect.java
@@ -1,7 +1,6 @@
package ch.asynk.rustanddust.game.states;
import ch.asynk.rustanddust.game.Map;
-import ch.asynk.rustanddust.game.Map.UnitType;
import ch.asynk.rustanddust.game.Hex;
import ch.asynk.rustanddust.game.Unit;
import ch.asynk.rustanddust.game.Ctrl;
@@ -64,7 +63,7 @@ public class StateSelect extends StateCommon
ctrl.setState(StateType.MOVE);
return;
}
- if (map.unitsContains(UnitType.TARGETS, upHex.getUnit())) {
+ if (map.unitsTargetContains(upHex.getUnit())) {
// quick fire
to = upHex;
ctrl.setState(StateType.ENGAGE);