diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-20 14:30:33 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-20 14:30:33 +0100 |
commit | ace9bc6875f0037e432f0d718495d09c55615ac3 (patch) | |
tree | 42eddc0bc7de79f10e53ae620e764ed0175ebd4a /core/src/ch/asynk/tankontank/game | |
parent | 893541b6132bf71e62c4cc4d3bcec844dee0b4be (diff) | |
download | RustAndDust-ace9bc6875f0037e432f0d718495d09c55615ac3.zip RustAndDust-ace9bc6875f0037e432f0d718495d09c55615ac3.tar.gz |
engine.PawnSet is dead : welcome UnitSet
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
13 files changed, 120 insertions, 94 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index 849742e..1a71725 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -163,7 +163,7 @@ public class Ctrl implements Disposable StateType nextState = this.state.done(); if (nextState == StateType.DONE) { - if (map.activatedPawns.size() > 0) { + if (map.activatedUnits.size() > 0) { TankOnTank.debug("burn down 1AP"); player.burnDownOneAp(); hud.update(); diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index f4c54e5..09aa4fe 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -1,6 +1,5 @@ package ch.asynk.tankontank.game; -import java.util.List; import java.util.Random; import com.badlogic.gdx.audio.Sound; @@ -11,7 +10,6 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import ch.asynk.tankontank.TankOnTank; import ch.asynk.tankontank.engine.Pawn; -import ch.asynk.tankontank.engine.PawnSet; import ch.asynk.tankontank.engine.Board; import ch.asynk.tankontank.engine.Orientation; import ch.asynk.tankontank.engine.Meteorology; @@ -31,11 +29,11 @@ public abstract class Map extends Board public final HexSet possibleMoves; public final PossiblePaths possiblePaths; - public final Board.PawnCollection moveablePawns; - public final Board.PawnCollection possibleTargets; - public final Board.PawnCollection engagementAssists; - public final Board.PawnCollection activatedPawns; - public final Board.PawnCollection breakPawns; + public final UnitSet moveableUnits; + public final UnitSet possibleTargets; + public final UnitSet engagementAssists; + public final UnitSet activatedUnits; + public final UnitSet breakUnits; public final Meteorology meteorology; @@ -66,12 +64,12 @@ public abstract class Map extends Board possibleMoves = new HexSet(this, 40); possiblePaths = new PossiblePaths(this, 10, 20, 5, 10); - moveablePawns = new PawnSet(this, 6); + moveableUnits = new UnitSet(this, 6); - possibleTargets = new PawnSet(this, 10); - engagementAssists = new PawnSet(this, 6); - activatedPawns = new PawnSet(this, 7); - breakPawns = new PawnSet(this, 4); + possibleTargets = new UnitSet(this, 10); + engagementAssists = new UnitSet(this, 6); + activatedUnits = new UnitSet(this, 7); + breakUnits = new UnitSet(this, 4); meteorology = new Meteorology(); } @@ -92,10 +90,10 @@ public abstract class Map extends Board possibleMoves.clear(); possibleTargets.clear(); possiblePaths.clear(); - moveablePawns.clear(); + moveableUnits.clear(); engagementAssists.clear(); - activatedPawns.clear(); - breakPawns.clear(); + activatedUnits.clear(); + breakUnits.clear(); } public Hex getHexAt(float x, float y) @@ -122,44 +120,44 @@ public abstract class Map extends Board return possiblePaths.toggleCtrlTile(hex); } - public int collectPossibleTargets(Unit unit, List<Pawn> foes) + public int collectPossibleTargets(Unit unit, UnitSet foes) { if (!unit.canEngage()) { possibleTargets.clear(); return 0; } // return collectPossibleTargets(unit, possibleTargets); - return collectPossibleTargets(unit, foes, possibleTargets); + return collectPossibleTargets(unit, foes.asPawns(), possibleTargets.asPawns()); } - public int collectMoveablePawns(Unit unit) + public int collectMoveableUnits(Unit unit) { if (unit.isHq() && !unit.movement.entryMove) { - collectMoveAssists(unit, moveablePawns); + collectMoveAssists(unit, moveableUnits.asPawns()); } else { - moveablePawns.clear(); + moveableUnits.clear(); } if (unit.canMove()) - moveablePawns.add(unit); - return moveablePawns.size(); + moveableUnits.add(unit); + return moveableUnits.size(); } - public int collectAttackAssists(Unit unit, Unit target, List<Pawn> units) + public int collectAttackAssists(Unit unit, Unit target, UnitSet units) { - int s = collectAttackAssists(unit, target, units, engagementAssists); - activatedPawns.add(unit); + int s = collectAttackAssists(unit, target, units.asPawns(), engagementAssists.asPawns()); + activatedUnits.add(unit); return s; } public boolean toggleAttackAssist(Unit unit) { - if (activatedPawns.contains(unit)) { - activatedPawns.remove(unit); + if (activatedUnits.contains(unit)) { + activatedUnits.remove(unit); unit.hideAttack(); unit.showAttackAssist(); return false; } else { - activatedPawns.add(unit); + activatedUnits.add(unit); unit.showAttack(); unit.hideAttackAssist(); return true; @@ -169,12 +167,12 @@ public abstract class Map extends Board public void collectAndShowMovesAndAssits(Unit unit) { hidePossibleMoves(); - hideMoveablePawns(); + hideMoveableUnits(); collectPossibleMoves(unit); - collectMoveablePawns(unit); + collectMoveableUnits(unit); showPossibleMoves(); - showMoveablePawns(); - activatedPawns.clear(); + showMoveableUnits(); + activatedUnits.clear(); } // ACTIONS @@ -197,10 +195,10 @@ public abstract class Map extends Board public void leaveBoard(Unit unit) { removePawn(unit); - activatedPawns.add(unit); + activatedUnits.add(unit); } - public int movePawn(Unit unit, Orientation o) + public int moveUnit(Unit unit, Orientation o) { possiblePaths.orientation = o; movePawn(unit, possiblePaths, notifyDoneAnimation(unit)); @@ -211,22 +209,22 @@ public abstract class Map extends Board public void revertMoves() { TankOnTank.debug(" revertMoves()"); - for (Pawn pawn: activatedPawns) { - revertLastPawnMove(pawn, notifyDoneAnimation(pawn)); + for (Unit unit: activatedUnits) { + revertLastPawnMove(unit, notifyDoneAnimation(unit)); } - activatedPawns.clear(); + activatedUnits.clear(); } private int startMove(Unit unit) { - moveablePawns.remove(unit); - activatedPawns.add(unit); + moveableUnits.remove(unit); + activatedUnits.add(unit); sound = moveSound; soundId = sound.play(1.0f); - return moveablePawns.size(); + return moveableUnits.size(); } - private RunnableAnimation notifyDoneAnimation(final Pawn unit) + private RunnableAnimation notifyDoneAnimation(final Unit unit) { return RunnableAnimation.get(unit, new Runnable() { @Override @@ -264,7 +262,7 @@ public abstract class Map extends Board boolean flankAttack = false; boolean terrainBonus = true; - for (Pawn assist : activatedPawns) { + for (Pawn assist : activatedUnits) { if (assist.isFlankAttack()) flankAttack = true; if (assist.isA(Unit.UnitType.INFANTRY)) @@ -276,7 +274,7 @@ public abstract class Map extends Board } } - int cnt = activatedPawns.size(); + int cnt = activatedUnits.size(); int def = target.getDefense(unit.getTile()); int flk = (flankAttack ? Unit.FLANK_ATTACK_BONUS : 0); int tdf = (terrainBonus ? unit.getTile().defense() : 0); @@ -297,10 +295,10 @@ public abstract class Map extends Board } } - public boolean engagePawn(Unit unit, final Unit target) + public boolean engageUnit(Unit unit, final Unit target) { boolean mayReroll = false; - for (Pawn assist : activatedPawns) { + for (Unit assist : activatedUnits) { if (((Unit) assist).isAce()) mayReroll = true; } @@ -330,15 +328,15 @@ public abstract class Map extends Board })); } - breakPawns.clear(); - for (Pawn p : activatedPawns) { - p.engage(); - if (p.isA(Unit.UnitType.INFANTRY)) - breakPawns.add(p); + breakUnits.clear(); + for (Unit u: activatedUnits) { + u.engage(); + if (u.isA(Unit.UnitType.INFANTRY)) + breakUnits.add(u); } - if ((activatedPawns.size() == 1) && unit.isA(Unit.UnitType.AT_GUN) && target.isHardTarget()) - activatedPawns.clear(); + if ((activatedUnits.size() == 1) && unit.isA(Unit.UnitType.AT_GUN) && target.isHardTarget()) + activatedUnits.clear(); addAnimation(seq); sound = engagementSound; @@ -362,15 +360,15 @@ public abstract class Map extends Board 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 showMoveablePawns() { moveablePawns.enable(Unit.MOVE, true); } - public void hideMoveablePawns() { moveablePawns.enable(Unit.MOVE, false); } + public void showMoveableUnits() { moveableUnits.enable(Unit.MOVE, true); } + public void hideMoveableUnits() { moveableUnits.enable(Unit.MOVE, false); } public void showPossibleTargets() { possibleTargets.enable(Unit.TARGET, true); } public void hidePossibleTargets() { possibleTargets.enable(Unit.TARGET, false); } public void showAttackAssists() { engagementAssists.enable(Unit.MAY_FIRE, true); } public void hideAttackAssists() { engagementAssists.enable(Unit.FIRE, false); engagementAssists.enable(Unit.MAY_FIRE, false); } - public void showBreakPawns() { breakPawns.enable(Unit.MOVE, true); } - public void hideBreakPawns() { breakPawns.enable(Unit.MOVE, false); } + public void showBreakUnits() { breakUnits.enable(Unit.MOVE, true); } + public void hideBreakUnits() { breakUnits.enable(Unit.MOVE, false); } public void showObjective(Hex hex) { enableOverlayOn(hex, Hex.OBJECTIVE, true); } public void hideObjective(Hex hex) { enableOverlayOn(hex, Hex.OBJECTIVE, true); } diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index 34f933f..f92e74c 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.ArrayList; import ch.asynk.tankontank.TankOnTank; -import ch.asynk.tankontank.engine.Pawn; public class Player { @@ -19,7 +18,7 @@ public class Player private boolean deploymentDone; public Army army; - public ArrayList<Unit> units; + public UnitSet units; public ArrayList<Unit> casualties; public ArrayList<Unit> reinforcement; public ArrayList<Unit> escaped; @@ -31,7 +30,7 @@ public class Player public Player(final TankOnTank game, Army army, int n) { this.army = army; - this.units = new ArrayList<Unit>(n); + this.units = new UnitSet(null, n); // FIXME ugly this.casualties = new ArrayList<Unit>(n); this.reinforcement = new ArrayList<Unit>(n); this.escaped = new ArrayList<Unit>(n); @@ -75,12 +74,6 @@ public class Player return army.isEnemy(other); } - @SuppressWarnings("unchecked") - public List<Pawn> unitsAsPawns() - { - return (List) units; - } - public int unitsLeft() { return (units.size() + reinforcement.size()); diff --git a/core/src/ch/asynk/tankontank/game/UnitSet.java b/core/src/ch/asynk/tankontank/game/UnitSet.java new file mode 100644 index 0000000..e4e63c0 --- /dev/null +++ b/core/src/ch/asynk/tankontank/game/UnitSet.java @@ -0,0 +1,35 @@ +package ch.asynk.tankontank.game; + +import java.util.Collection; +import java.util.LinkedHashSet; + +import ch.asynk.tankontank.engine.Pawn; + +public class UnitSet extends LinkedHashSet<Unit> +{ + private final Map map; + + public UnitSet(Map map, int n) + { + super(n); + this.map = map; + } + + @SuppressWarnings("unchecked") + public Collection<Pawn> asPawns() + { + return (Collection) this; + } + + public Unit first() + { + if (isEmpty()) return null; + return iterator().next(); + } + + public void enable(int i, boolean enable) + { + for (Unit unit : this) + unit.enableOverlay(i, enable); + } +} diff --git a/core/src/ch/asynk/tankontank/game/states/StateBreak.java b/core/src/ch/asynk/tankontank/game/states/StateBreak.java index 6b5dea2..034bb0b 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateBreak.java +++ b/core/src/ch/asynk/tankontank/game/states/StateBreak.java @@ -16,13 +16,13 @@ public class StateBreak extends StateCommon activeUnit = null; ctrl.hud.actionButtons.show(Buttons.DONE.b); ctrl.hud.pushNotify("Break move possible"); - map.showBreakPawns(); + map.showBreakUnits(); } @Override public void leave(StateType nextState) { - map.hideBreakPawns(); + map.hideBreakUnits(); map.hideMove(to); map.hideDirections(to); map.hideOrientation(to); @@ -51,12 +51,12 @@ public class StateBreak extends StateCommon { if (activeUnit == null) { Unit unit = upHex.getUnit(); - if (map.breakPawns.contains(unit)) { + if (map.breakUnits.contains(unit)) { activeUnit = unit; map.showMove(upHex); map.showMove(to); map.showDirections(to); - map.hideBreakPawns(); + map.hideBreakUnits(); } } else { o = Orientation.fromAdj(to, upHex); @@ -81,7 +81,7 @@ public class StateBreak extends StateCommon map.possiblePaths.init(activeUnit); if (map.possiblePaths.build(to) == 1) { map.possiblePaths.orientation = o; - map.movePawn(activeUnit, o); + map.moveUnit(activeUnit, o); ctrl.setAnimationCount(1); ctrl.setAfterAnimationState(StateType.DONE); } else diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java index 2da80ae..b20c5d0 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java @@ -68,14 +68,14 @@ public abstract class StateCommon implements State { if (ctrl.cfg.showMoves && pawn.canMove()) map.showPossibleMoves(); if (ctrl.cfg.showTargets && pawn.canEngage()) map.showPossibleTargets(); - if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveablePawns(); + if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveableUnits(); } protected void hidePossibilities() { map.hidePossibleMoves(); map.hidePossibleTargets(); - map.hideMoveablePawns(); + map.hideMoveableUnits(); } protected boolean checkExit(Unit unit, Hex hex) diff --git a/core/src/ch/asynk/tankontank/game/states/StateDeployment.java b/core/src/ch/asynk/tankontank/game/states/StateDeployment.java index 89e97aa..ace1265 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateDeployment.java +++ b/core/src/ch/asynk/tankontank/game/states/StateDeployment.java @@ -1,10 +1,10 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.engine.Orientation; -import ch.asynk.tankontank.engine.PawnSet; import ch.asynk.tankontank.game.Hex; import ch.asynk.tankontank.game.Zone; import ch.asynk.tankontank.game.Unit; +import ch.asynk.tankontank.game.UnitSet; import ch.asynk.tankontank.game.hud.ActionButtons.Buttons; import ch.asynk.tankontank.TankOnTank; @@ -13,7 +13,7 @@ public class StateDeployment extends StateCommon { private boolean done; private Zone entryZone; - private PawnSet deployedUnits = new PawnSet(map, 10); + private UnitSet deployedUnits = new UnitSet(map, 10); @Override public void enter(StateType prevState) diff --git a/core/src/ch/asynk/tankontank/game/states/StateEngage.java b/core/src/ch/asynk/tankontank/game/states/StateEngage.java index 0ef213d..14465cc 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateEngage.java +++ b/core/src/ch/asynk/tankontank/game/states/StateEngage.java @@ -19,7 +19,7 @@ public class StateEngage extends StateCommon activeUnit = null; // use selectedHex and selectedUnit map.hidePossibleTargets(); - map.collectPossibleTargets(selectedUnit, ctrl.opponent.unitsAsPawns()); + map.collectPossibleTargets(selectedUnit, ctrl.opponent.units); map.showPossibleTargets(); if (to != null) { // quick fire -> replay touchUp @@ -46,7 +46,7 @@ public class StateEngage extends StateCommon @Override public StateType abort() { - map.activatedPawns.clear(); + map.activatedUnits.clear(); return StateType.ABORT; } @@ -54,11 +54,11 @@ public class StateEngage extends StateCommon public StateType done() { StateType nextState = StateType.DONE; - if (map.engagePawn(selectedUnit, activeUnit)) { + if (map.engageUnit(selectedUnit, activeUnit)) { ctrl.player.wonEngagementCount += 1; ctrl.hud.notify(selectedUnit.engagement.calculus + " : " + activeUnit + " is destroyed"); ctrl.opponent.casualty(activeUnit); - if (map.breakPawns.size() > 0) { + if (map.breakUnits.size() > 0) { nextState = StateType.BREAK; } } else { @@ -89,7 +89,7 @@ public class StateEngage extends StateCommon to = upHex; activeUnit = unit; activeUnit.showTarget(); - map.collectAttackAssists(selectedUnit, activeUnit, ctrl.player.unitsAsPawns()); + map.collectAttackAssists(selectedUnit, activeUnit, ctrl.player.units); map.showAttackAssists(); ctrl.hud.actionButtons.show(Buttons.ENGAGE.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateEscape.java b/core/src/ch/asynk/tankontank/game/states/StateEscape.java index 30af8e5..6c76a74 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateEscape.java +++ b/core/src/ch/asynk/tankontank/game/states/StateEscape.java @@ -61,7 +61,7 @@ public class StateEscape extends StateCommon map.leaveBoard(unit); ctrl.player.unitEscape(unit); - if (map.movePawn(activeUnit, exitZone.orientation) > 0) + if (map.moveUnit(activeUnit, exitZone.orientation) > 0) return StateType.MOVE; return StateType.DONE; } diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index d56c650..13280ce 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -9,7 +9,7 @@ public class StateMove extends StateCommon @Override public void enter(StateType prevState) { - boolean moreThanOne = ((map.moveablePawns.size() + map.activatedPawns.size()) > 1); + boolean moreThanOne = ((map.moveableUnits.size() + map.activatedUnits.size()) > 1); ctrl.hud.actionButtons.show(Buttons.ROTATE.b | Buttons.MOVE.b | ((moreThanOne) ? Buttons.DONE.b : 0) | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); ctrl.hud.actionButtons.setOn(Buttons.MOVE); @@ -38,7 +38,7 @@ public class StateMove extends StateCommon if (selectedUnit.canMove()) { changeUnit(selectedUnit); } else { - changeUnit((Unit) map.moveablePawns.first()); + changeUnit((Unit) map.moveableUnits.first()); } } } @@ -67,7 +67,7 @@ public class StateMove extends StateCommon public StateType abort() { hideAssists(); - int n = map.activatedPawns.size(); + int n = map.activatedUnits.size(); if (n == 0) return StateType.ABORT; ctrl.setAnimationCount(n); @@ -84,7 +84,7 @@ public class StateMove extends StateCommon { hideAssists(); // be sure that the hq is activated - if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) + if (selectedUnit.canMove() && (map.activatedUnits.size() > 0)) selectedUnit.setMoved(); return StateType.DONE; @@ -102,7 +102,7 @@ public class StateMove extends StateCommon Unit unit = upHex.getUnit(); - if (map.moveablePawns.contains(unit)) { + if (map.moveableUnits.contains(unit)) { if(unit != activeUnit) changeUnit(unit); } else if ((s == 0) && map.possibleMoves.contains(upHex)) { @@ -119,7 +119,7 @@ public class StateMove extends StateCommon private void hideAssists() { - map.hideMoveablePawns(); + map.hideMoveableUnits(); } private void changeUnit(Unit unit) diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java index 3d83ec3..8606986 100644 --- a/core/src/ch/asynk/tankontank/game/states/StatePromote.java +++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java @@ -10,7 +10,7 @@ public class StatePromote extends StateCommon ctrl.hud.actionButtons.hide(); String str = selectedUnit.toString(); if (ctrl.player.promote(selectedUnit)) { - map.activatedPawns.add(selectedUnit); + map.activatedUnits.add(selectedUnit); ctrl.hud.notify(str+ " has been promoted"); } ctrl.setState(StateType.DONE); diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index c9949ab..ddc5737 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -60,7 +60,7 @@ public class StateRotate extends StateCommon map.leaveBoard(activeUnit); ctrl.player.revertUnitEntry(activeUnit); } - if (map.activatedPawns.size() == 0) { + if (map.activatedUnits.size() == 0) { hideAssists(); } else { nextState = StateType.MOVE; @@ -104,7 +104,7 @@ public class StateRotate extends StateCommon private void hideAssists() { - map.hideMoveablePawns(); + map.hideMoveableUnits(); } private void doRotation(Orientation o) @@ -112,7 +112,7 @@ public class StateRotate extends StateCommon StateType whenDone = StateType.DONE; ctrl.hud.notify("Move " + activeUnit); - if (map.movePawn(activeUnit, o) > 0) + if (map.moveUnit(activeUnit, o) > 0) whenDone = StateType.MOVE; ctrl.setAnimationCount(1); diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index ae70328..46b73c0 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -77,11 +77,11 @@ public class StateSelect extends StateCommon int moves = map.collectPossibleMoves(selectedUnit); int targets = 0; if (isEnemy) - targets = map.collectPossibleTargets(selectedUnit, ctrl.player.unitsAsPawns()); + targets = map.collectPossibleTargets(selectedUnit, ctrl.player.units); else - targets = map.collectPossibleTargets(selectedUnit, ctrl.opponent.unitsAsPawns()); + targets = map.collectPossibleTargets(selectedUnit, ctrl.opponent.units); if (moves > 0) - map.collectMoveablePawns(selectedUnit); + map.collectMoveableUnits(selectedUnit); showPossibilities(selectedUnit); ctrl.hud.actionButtons.show( ((ctrl.player.canPromote(selectedUnit)) ? Buttons.PROMOTE.b : 0 ) | |