From a6c03e7c812af6da3e4fd799bb47f09366105b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 3 Jul 2020 17:08:08 +0200 Subject: isOnMap -> isOnBoard --- core/src/ch/asynk/gdx/boardgame/Tile.java | 2 +- core/src/ch/asynk/gdx/boardgame/boards/Board.java | 2 +- .../ch/asynk/gdx/boardgame/boards/HexBoard.java | 26 +++++++++++----------- .../ch/asynk/gdx/boardgame/boards/SquareBoard.java | 4 ++-- .../asynk/gdx/boardgame/boards/TriangleBoard.java | 4 ++-- .../ch/asynk/gdx/boardgame/test/BoardScreen.java | 10 ++++----- .../src/ch/asynk/gdx/boardgame/test/HexScreen.java | 6 ++--- test/src/ch/asynk/gdx/boardgame/test/Tests.java | 4 ++-- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/core/src/ch/asynk/gdx/boardgame/Tile.java b/core/src/ch/asynk/gdx/boardgame/Tile.java index ffb73cc..b55a807 100644 --- a/core/src/ch/asynk/gdx/boardgame/Tile.java +++ b/core/src/ch/asynk/gdx/boardgame/Tile.java @@ -45,7 +45,7 @@ public class Tile implements Drawable } } - public boolean isOnMap() + public boolean isOnBoard() { return onMap; } diff --git a/core/src/ch/asynk/gdx/boardgame/boards/Board.java b/core/src/ch/asynk/gdx/boardgame/boards/Board.java index 0fde498..7af37f1 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/Board.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/Board.java @@ -13,7 +13,7 @@ public interface Board extends TileKeyGenerator public int[] getAngles(); public Tile getTile(int x, int y); - public boolean isOnMap(int x, int y); + public boolean isOnBoard(int x, int y); public void centerOf(int x, int y, Vector2 v); public void toBoard(float x, float y, Vector2 v); diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java index 800953a..18aba17 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java @@ -99,7 +99,7 @@ public class HexBoard implements Board @Override public Tile getTile(int x, int y) { - return tileProvider.getTile(x, y, isOnMap(x, y)); + return tileProvider.getTile(x, y, isOnBoard(x, y)); } @Override public int[] getAngles() @@ -126,7 +126,7 @@ public class HexBoard implements Board @Override public int genKey(int x, int y) { - if (!isOnMap(x, y)) return -1; + if (!isOnBoard(x, y)) return -1; if (vertical) { return _genKey(x, y); } else { @@ -144,16 +144,16 @@ public class HexBoard implements Board return i; } - @Override public boolean isOnMap(int x, int y) + @Override public boolean isOnBoard(int x, int y) { if (vertical) { - return _isOnMap(x, y); + return _isOnBoard(x, y); } else { - return _isOnMap(y, x); + return _isOnBoard(y, x); } } - private boolean _isOnMap(int x, int y) + private boolean _isOnBoard(int x, int y) { if ((y < 0) || (y >= rows)) return false; if ((x < ((y + 1) / 2)) || (x >= (cols + (y / 2)))) return false; @@ -384,7 +384,7 @@ public class HexBoard implements Board else x += dx; // right Tile t = getTile(x, y); - if (t.isOnMap()) { + if (t.isOnBoard()) { tiles.add(t); t.blocked = losBlocked; if (t.blockLos(from, to, d, distance(x0, y0, x, y))) @@ -398,7 +398,7 @@ public class HexBoard implements Board if (!q13) x -= dx; } t = getTile(x, y); - if (t.isOnMap()) { + if (t.isOnBoard()) { tiles.add(t); t.blocked = losBlocked; if (t.blockLos(from, to, d, distance(x0, y0, x, y))) @@ -410,7 +410,7 @@ public class HexBoard implements Board else x += dx; // diagonal t = getTile(x, y); - if (t.isOnMap()) { + if (t.isOnBoard()) { tiles.add(t); t.blocked = (losBlocked || blocked == 0x03); if (t.blocked && !contact) { @@ -541,7 +541,7 @@ public class HexBoard implements Board from.parent = null; from.searchCount = searchCount; - if (from.acc <= 0 || !from.isOnMap()) + if (from.acc <= 0 || !from.isOnBoard()) return tiles.size(); int roadMarchBonus = piece.roadMarchBonus(); @@ -556,7 +556,7 @@ public class HexBoard implements Board buildAdjacents(src.x, src.y); for (int i = 0, j = 0; i < 6; i++, j++) { final Tile dst = adjacents[i]; - if (!dst.isOnMap()) continue; + if (!dst.isOnBoard()) continue; if (getAngles()[j] == -1) j++; final Orientation o = Orientation.fromR(getAngles()[j] + aOffset); @@ -596,7 +596,7 @@ public class HexBoard implements Board from.parent = null; from.searchCount = searchCount; - if (from == to || !from.isOnMap() || !to.isOnMap()) + if (from == to || !from.isOnBoard() || !to.isOnBoard()) return tiles.size(); int roadMarchBonus = piece.roadMarchBonus(); @@ -612,7 +612,7 @@ public class HexBoard implements Board buildAdjacents(src.x, src.y); for (int i = 0, j = 0; i < 6; i++, j++) { final Tile dst = adjacents[i]; - if (!dst.isOnMap()) continue; + if (!dst.isOnBoard()) continue; if (getAngles()[j] == -1) j++; final Orientation o = Orientation.fromR(getAngles()[j] + aOffset); diff --git a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java index bede2ea..c7fa576 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java @@ -40,7 +40,7 @@ public class SquareBoard implements Board @Override public Tile getTile(int x, int y) { - return tileProvider.getTile(x, y, isOnMap(x, y)); + return tileProvider.getTile(x, y, isOnBoard(x, y)); } @Override public int[] getAngles() { return angles; } @@ -64,7 +64,7 @@ public class SquareBoard implements Board return (y * cols + x); } - @Override public boolean isOnMap(int x, int y) + @Override public boolean isOnBoard(int x, int y) { if (x < 0 || x >= cols || y < 0 || y >= rows) return false; return true; diff --git a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java index e23bdec..406089f 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java @@ -55,7 +55,7 @@ public class TriangleBoard implements Board @Override public Tile getTile(int x, int y) { - return tileProvider.getTile(x, y, isOnMap(x, y)); + return tileProvider.getTile(x, y, isOnBoard(x, y)); } @Override public int[] getAngles() @@ -79,7 +79,7 @@ public class TriangleBoard implements Board return (y * cols + x); } - @Override public boolean isOnMap(int x, int y) + @Override public boolean isOnBoard(int x, int y) { if (x < 0 || x >= cols || y < 0 || y >= rows) return false; return true; diff --git a/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java b/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java index de70ce4..7e25363 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java @@ -74,7 +74,7 @@ public class BoardScreen extends AbstractScreen { board.toBoard(x, y, v); Tile tile = board.getTile((int)v.x, (int)v.y); - if (!tile.isOnMap()) + if (!tile.isOnBoard()) return false; if (down) { if (!dragging && panzer.isOn(tile)) { @@ -122,7 +122,7 @@ public class BoardScreen extends AbstractScreen private void clearAdjacents() { for (Tile tile : board.getAdjacents()) { - if (tile.isOnMap()) { + if (tile.isOnBoard()) { tilesToDraw.remove(tile); tile.enableOverlay(12, false); } @@ -134,16 +134,16 @@ public class BoardScreen extends AbstractScreen clearAdjacents(); board.buildAdjacents((int)v.x, (int)v.y); for (Tile tile : board.getAdjacents()) { - if (tile.isOnMap()) { + if (tile.isOnBoard()) { tilesToDraw.add(tile); tile.enableOverlay(12, true); } } } - private Tile getTile(int x, int y, boolean isOnMap) + private Tile getTile(int x, int y, boolean isOnBoard) { - if (isOnMap) + if (isOnBoard) return tileStorage.getTile(x, y, board::genKey, this::buildTile); return Tile.OffMap; } diff --git a/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java b/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java index cda4521..c3d93f2 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java @@ -275,9 +275,9 @@ public class HexScreen extends AbstractScreen public int getWidth() { return map.getWidth(); } public int getHeight() { return map.getHeight(); } - private Tile getTile(int x, int y, boolean isOnMap) + private Tile getTile(int x, int y, boolean isOnBoard) { - if (isOnMap) + if (isOnBoard) return tileStorage.getTile(x, y, board::genKey, this::buildTile); return Tile.OffMap; } @@ -328,7 +328,7 @@ public class HexScreen extends AbstractScreen { board.toBoard(x, y, v); Tile tile = board.getTile((int)v.x, (int)v.y); - if (!tile.isOnMap()) + if (!tile.isOnBoard()) return false; if (down) { if (!panzer.dragging && panzer.isOn(tile)) { diff --git a/test/src/ch/asynk/gdx/boardgame/test/Tests.java b/test/src/ch/asynk/gdx/boardgame/test/Tests.java index eff7afa..9120bcc 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/Tests.java +++ b/test/src/ch/asynk/gdx/boardgame/test/Tests.java @@ -76,9 +76,9 @@ public class Tests check((g == k), title, "Key", k); } - private Tile getTile(int x, int y, boolean isOnMap) + private Tile getTile(int x, int y, boolean isOnBoard) { - if (isOnMap) + if (isOnBoard) return tileStorage.getTile(x, y, board::genKey, this::buildTile); return Tile.OffMap; } -- cgit v1.1-2-g2b99