diff options
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 9 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/battles/BattleFake.java | 34 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateCommon.java | 2 |
3 files changed, 22 insertions, 23 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 9c7a882..e6ce882 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -92,9 +92,9 @@ public abstract class Map extends Board return (Hex) getTile(col, row); } - public Hex getHexSafe(GridPoint2 hex) + public Hex getHexSafe(int col, int row) { - return (Hex) getTileSafe(hex.x, hex.y); + return (Hex) getTileSafe(col, row); } public GridPoint2 getFirstMoveAssist() @@ -398,9 +398,8 @@ public abstract class Map extends Board public void promote(Pawn pawn, Pawn with) { - GridPoint2 coords = getHexUnder(pawn); - removePawnFrom(pawn, coords); - setPawnAt(with, coords, pawn.getOrientation()); + removePawn(pawn); + setPawnOnto(with, pawn.getTile(), pawn.getOrientation()); activatedPawns.add(with); } } diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleFake.java b/core/src/ch/asynk/tankontank/game/battles/BattleFake.java index 19dcec7..f6f00dc 100644 --- a/core/src/ch/asynk/tankontank/game/battles/BattleFake.java +++ b/core/src/ch/asynk/tankontank/game/battles/BattleFake.java @@ -52,25 +52,25 @@ public class BattleFake extends BattleCommon Orientation o = Orientation.NORTH; GridPoint2 p = new GridPoint2(); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_TIGER), p.set(4, 7), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_TIGER), p.set(3, 6), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_PANZER_IV), p.set(3, 5), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_PANZER_IV_HQ), p.set(2, 4), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_PANZER_IV), p.set(2, 3), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_PANZER_IV), p.set(1, 2), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_PANZER_IV_HQ), p.set(1, 1), o)); - gePlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.GE_PANZER_IV), p.set(0, 0), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_TIGER), map.getHexSafe(4, 7), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_TIGER), map.getHexSafe(3, 6), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_PANZER_IV), map.getHexSafe(3, 5), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_PANZER_IV_HQ), map.getHexSafe(2, 4), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_PANZER_IV), map.getHexSafe(2, 3), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_PANZER_IV), map.getHexSafe(1, 2), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_PANZER_IV_HQ), map.getHexSafe(1, 1), o)); + gePlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.GE_PANZER_IV), map.getHexSafe(0, 0), o)); o = Orientation.SOUTH; - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_WOLVERINE), p.set(13, 8), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_WOLVERINE), p.set(12, 7), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_PRIEST), p.set(12, 6), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_SHERMAN), p.set(11, 5), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_SHERMAN_HQ), p.set(11, 4), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_SHERMAN), p.set(10, 3), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_SHERMAN), p.set(10, 2), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_SHERMAN_HQ), p.set(9, 1), o)); - usPlayer.addUnit(map.setPawnAt(factory.getUnit(UnitId.US_SHERMAN), p.set(9, 0), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_WOLVERINE), map.getHexSafe(13, 8), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_WOLVERINE), map.getHexSafe(12, 7), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_PRIEST), map.getHexSafe(12, 6), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_SHERMAN), map.getHexSafe(11, 5), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_SHERMAN_HQ), map.getHexSafe(11, 4), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_SHERMAN), map.getHexSafe(10, 3), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_SHERMAN), map.getHexSafe(10, 2), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_SHERMAN_HQ), map.getHexSafe(9, 1), o)); + usPlayer.addUnit(map.setPawnOnto(factory.getUnit(UnitId.US_SHERMAN), map.getHexSafe(9, 0), o)); } public boolean checkVictory() diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java index 2edda2c..5c73ee6 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java @@ -113,7 +113,7 @@ public abstract class StateCommon implements State isEnemy = ctrl.player.isEnemy(selectedPawn); else isEnemy = false; - System.err.println(" select " + map.getHexSafe(selectedHex) + selectedPawn + (isEnemy ? " enemy " : " friend ")); + System.err.println(" select " + map.getHexSafe(selectedHex.x, selectedHex.y) + selectedPawn + (isEnemy ? " enemy " : " friend ")); } protected void showPossibleTargetsMovesAssists(Pawn pawn) |