From 1a691b8f3be573eefd405b9ea53f0a50c8a5d332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 7 Oct 2014 20:46:34 +0200 Subject: Board: API consistency, rename parameters --- core/src/ch/asynk/tankontank/engine/Board.java | 30 +++++++++++++------------- 1 file 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; } -- cgit v1.1-2-g2b99