diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-07 20:46:34 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-07 20:46:34 +0200 |
commit | 1a691b8f3be573eefd405b9ea53f0a50c8a5d332 (patch) | |
tree | 644e3853208ae9e084986e215d08988bb8113169 | |
parent | 1c6560a2e8057470dc33f0767d9480148c31eedc (diff) | |
download | RustAndDust-1a691b8f3be573eefd405b9ea53f0a50c8a5d332.zip RustAndDust-1a691b8f3be573eefd405b9ea53f0a50c8a5d332.tar.gz |
Board: API consistency, rename parameters
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index f18403f..ae38c30 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -146,25 +146,25 @@ public abstract class Board implements Disposable return tiles[((col - colOffset)) + (row * cfg.cols)]; } - public void getAdjacentTiles(GridPoint2 hex, Tile tiles[]) + public void getAdjacentTiles(GridPoint2 coords, Tile tiles[]) { - tiles[0] = getTileSafe((hex.x - 1), hex.y); - tiles[1] = getTileSafe(hex.x, (hex.y + 1)); - tiles[2] = getTileSafe((hex.x + 1), (hex.y + 1)); - tiles[3] = getTileSafe((hex.x + 1), hex.y); - tiles[4] = getTileSafe(hex.x, (hex.y - 1)); - tiles[5] = getTileSafe((hex.x - 1), (hex.y - 1)); + tiles[0] = getTileSafe((coords.x - 1), coords.y); + tiles[1] = getTileSafe(coords.x, (coords.y + 1)); + tiles[2] = getTileSafe((coords.x + 1), (coords.y + 1)); + tiles[3] = getTileSafe((coords.x + 1), coords.y); + tiles[4] = getTileSafe(coords.x, (coords.y - 1)); + tiles[5] = getTileSafe((coords.x - 1), (coords.y - 1)); } - public GridPoint2 setNeighbour(GridPoint2 hex, Orientation o, GridPoint2 n) + public GridPoint2 setNeighbour(GridPoint2 coords, Orientation o, GridPoint2 n) { - if (o == Orientation.NORTH) n.set((hex.x + 1), hex.y); - else if (o == Orientation.NORTH_EAST) n.set(hex.x, (hex.y - 1)); - else if (o == Orientation.SOUTH_EAST) n.set((hex.x - 1), (hex.y - 1)); - else if (o == Orientation.SOUTH) n.set((hex.x - 1), hex.y); - else if (o == Orientation.SOUTH_WEST) n.set(hex.x, (hex.y + 1)); - else if (o == Orientation.NORTH_WEST) n.set((hex.x + 1), (hex.y + 1)); - else n.set(hex.x, hex.y); + if (o == Orientation.NORTH) n.set((coords.x + 1), coords.y); + else if (o == Orientation.NORTH_EAST) n.set(coords.x, (coords.y - 1)); + else if (o == Orientation.SOUTH_EAST) n.set((coords.x - 1), (coords.y - 1)); + else if (o == Orientation.SOUTH) n.set((coords.x - 1), coords.y); + else if (o == Orientation.SOUTH_WEST) n.set(coords.x, (coords.y + 1)); + else if (o == Orientation.NORTH_WEST) n.set((coords.x + 1), (coords.y + 1)); + else n.set(coords.x, coords.y); return n; } |