diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/src/ch/asynk/tankontank/engine/Move.java | 28 | ||||
| -rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 9 | 
2 files changed, 18 insertions, 19 deletions
| diff --git a/core/src/ch/asynk/tankontank/engine/Move.java b/core/src/ch/asynk/tankontank/engine/Move.java index b12b8da..0eb3c86 100644 --- a/core/src/ch/asynk/tankontank/engine/Move.java +++ b/core/src/ch/asynk/tankontank/engine/Move.java @@ -42,6 +42,22 @@ public class Move extends Path implements Iterable<Vector3>          return m;      } +    public static Move getEnter(Pawn pawn, Tile to, Orientation orientation) +    { +        Move m = get(pawn, null, to, orientation, null); +        m.type = MoveType.ENTER; +        m.cost = to.costFrom(pawn, orientation); +        return m; +    } + +    public static Move getSet(Pawn pawn, Tile to, Orientation orientation) +    { +        Move m = get(pawn, null, to, orientation, null); +        m.type = MoveType.SET; +        m.cost = 0; +        return m; +    } +      public Pawn pawn;      public Tile from;      public Tile to; @@ -86,18 +102,6 @@ public class Move extends Path implements Iterable<Vector3>          return (type != MoveType.ENTER);      } -    public void setSet() -    { -        type = MoveType.SET; -        cost = 0; -    } - -    public void setEnter() -    { -        type = MoveType.ENTER; -        cost = to.costFrom(pawn, orientation); -    } -      public void setExit()      {          type = MoveType.EXIT; diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index eca6e64..7a28a70 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -273,10 +273,8 @@ public abstract class Map extends Board          if (entry == Orientation.KEEP)              return false; -        Move move = Move.get(unit, null, to, entry, null); -        move.setEnter(); -        enterPawn(unit, move); +        enterPawn(unit, Move.getEnter(unit, to, entry));          objectives.claim(to, unit.getArmy());          return true;      } @@ -285,10 +283,7 @@ public abstract class Map extends Board      {          TankOnTank.debug("Map", String.format("set %s %s %s", to.toShort(), unit, entry)); -        Move move = Move.get(unit, null, to, entry, null); -        move.setSet(); - -        setPawnOnto(unit, move); +        setPawnOnto(unit, Move.getSet(unit, to, entry));          objectives.claim(to, unit.getArmy());          return true;      } | 
