diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-22 12:16:53 +0200 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-22 12:16:53 +0200 | 
| commit | 65d676c114dce17f5d9a208a37f9e386a593e70d (patch) | |
| tree | 42ba59ac9cffb14e686e9e0f2c3d6c31ef194ba4 /core/src | |
| parent | cbd3855d120cfc9e50c5431d48430df54efc570d (diff) | |
| download | RustAndDust-65d676c114dce17f5d9a208a37f9e386a593e70d.zip RustAndDust-65d676c114dce17f5d9a208a37f9e386a593e70d.tar.gz | |
Board: remove getTile(GridPoint2) and getTileSafe(GirdPoint2)
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 30 | 
1 files changed, 10 insertions, 20 deletions
| diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index b82c8c7..66e3fd7 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -144,24 +144,14 @@ public abstract class Board implements Disposable              transform = false;      } -    public Tile getTile(GridPoint2 coords) -    { -        return getTile(coords.x, coords.y); -    } - -    public Tile getTile(int col, int row) +    protected Tile getTile(int col, int row)      {          int idx = ((col - ((row + 1) / 2))) + (row * cfg.cols);          // Gdx.app.debug("Board", " getTile: " + col + " ; " + row + " -> " + idx);          return tiles[idx];      } -    public Tile getTileSafe(GridPoint2 coords) -    { -        return getTileSafe(coords.x, coords.y); -    } - -    public Tile getTileSafe(int col, int row) +    protected Tile getTileSafe(int col, int row)      {          int colOffset = ((row + 1) / 2);          if ((col < colOffset) || (row < 0) || (row >= cfg.rows) || ((col - colOffset) >= cfg.cols)) @@ -473,22 +463,22 @@ public abstract class Board implements Disposable      protected boolean hasUnits(GridPoint2 coords)      { -        return getTile(coords).hasUnits(); +        return getTile(coords.x, coords.y).hasUnits();      }      public boolean isOffMap(GridPoint2 coords)      { -        return getTile(coords).isOffMap(); +        return getTile(coords.x, coords.y).isOffMap();      }      protected boolean isOverlayEnabledOn(GridPoint2 coords, int i)      { -        return getTile(coords).isOverlayEnabled(i); +        return getTile(coords.x, coords.y).isOverlayEnabled(i);      }      public void enableOverlayOn(GridPoint2 coords, int i, boolean enable)      { -        Tile tile = getTile(coords); +        Tile tile = getTile(coords.x, coords.y);          if(tile.enableOverlay(i, enable))              tilesToDraw.add(tile);          else @@ -497,7 +487,7 @@ public abstract class Board implements Disposable      public void enableOverlayOn(GridPoint2 coords, int i, boolean enable, Orientation o)      { -        Tile tile = getTile(coords); +        Tile tile = getTile(coords.x, coords.y);          if(tile.enableOverlay(i, enable, o.r()))              tilesToDraw.add(tile);          else @@ -506,12 +496,12 @@ public abstract class Board implements Disposable      public Pawn getTopPawnAt(GridPoint2 coords)      { -        return getTile(coords).getTopPawn(); +        return getTile(coords.x, coords.y).getTopPawn();      }      private int pushPawnAt(Pawn pawn, GridPoint2 coords)      { -        Tile tile = getTile(coords); +        Tile tile = getTile(coords.x, coords.y);          tilesToDraw.add(tile);          return tile.push(pawn);      } @@ -523,7 +513,7 @@ public abstract class Board implements Disposable      public int removePawnFrom(Pawn pawn, GridPoint2 coords)      { -        Tile tile = getTile(coords); +        Tile tile = getTile(coords.x, coords.y);          int n = tile.remove(pawn);          if (!tile.mustBeDrawn())              tilesToDraw.remove(tile); | 
